Skip to content

Lift and shift the discussion block's code from edx-platform to xblocks contrib repo #451

Closed

Description

@salman2013

Lift and shift the following required files to load discussion xblock.

  • XBlock python code
  • Django templates
  • JS files
  • Css files

Acceptance criteria:

  • Discussion block should properly load on cms and lms.
  • Check the UI on cms and lms, everything is loading properly.
  • Test cases should be green

PR: openedx/xblocks-core#134

Activity

  1. moved this to 🔖 Ready in Aximprovements Teamon Dec 24, 2025
  2. farhan commented on Dec 24, 2025

    @farhan

    On the way we will decide either to adopt webpack or django pipeline

  3. moved this from 🔖 Ready to 🏗 In progress in Aximprovements Teamon Jan 5, 2026
  4. salman2013 commented on Jan 7, 2026

    @salman2013
    Author

    Course Level discussion tab:

    Image

    Discussion xblock:

    Image

    Implementation in platform

    Course level discussion tab is django view and discussion xblock is load from xmodule both uses same java script files which bundle up with django pipelines.
    Course level discussion tab load it with method in view.py
    Discussion xblock loads it with methods in xblock_utils

    Team discussion and thoughts:

    We discussed about the bundling of js files for discussion xblock in edx-platform either we should use the webpack or django pipeline, Right now the platform using django pipeline to bundle the files so we decided to follow the same architecture to minimize the efforts.

    Problem Statement:

    As part of the discussion block extraction, we need to move all JavaScript files to the xblocks-contrib repository. Currently, these files are bundled via the Django pipeline in edx-platform and are used by both the XBlock and the discussion Django view. The settings point all paths to the common static folder.

    If I update these paths directly to reference xblocks-contrib, the course-level Discussion tab (the Django view) would also become dependent on xblocks-contrib, which is not desired.

    To avoid this, I introduced a separate pipeline specifically for the extracted discussion block. This pipeline is responsible for loading JavaScript files (or bundled assets in production) from the xblocks-contrib repository, while the course-level Discussion tab (Django view) continues to function exactly as before, using its existing pipeline configuration.

    There is a draft PR for this solution: openedx/openedx-platform#37841
    Note: Right now the PR is using the local path as this is testing draft PR but i believe in actual it will load the path from package resource as the xblocks-contrib is installing as a package in edx-platform.

  5. salman2013 commented on Jan 7, 2026

    @salman2013
    Author

    @feanil @kdmccormick Please share your thoughts and feedback on this.
    #451 (comment)

  6. salman2013 commented on Jan 12, 2026

    @salman2013
    Author

    As per discussion in the meeting we decided to not go with this implementation of django pipeline openedx/openedx-platform#37841 as this creates circular dependency between edx-platform and xblocks-contrib.

    We decided to bundle up files with webpack

  7. salman2013 commented on Jan 12, 2026

    @salman2013
    Author

    I am facing some difficulty in using webpack.
    as per my understanding
    The js code using for discussion is classic ES5 JavaScript using an IIFE (Immediately Invoked Function Expression) with Backbone.js, jQuery, and global references.(Ref file)

    Webpack does support classic ES5 + IIFE code, but it changes the execution context, which breaks legacy code that assumes this === window and globals exist implicitly.

    Right now i have extracted all files in xblocks-contrib PR and using them directly instead of bundled files. I am creating separate ticket(Ref) to look it up in detail so that i can complete the scope of this ticket's work.

  8. salman2013 commented on Jan 20, 2026

    @salman2013
    Author

    All the files including (JS, CSS and python) have been moved to xblocks-contrib repo under the scope of this ticket and the PR has created.
    PR: openedx/xblocks-core#134

    Right now i am using all JS files directly instead of bundled files. I have creating separate ticket(#480) to look it up in detail.
    I am closing this ticket as the scope of this task has been completed and i will do other subtasks on the base of this PR.

  9. moved this from 🏗 In progress to ✅ Done in Aximprovements Teamon Jan 20, 2026
  10. kdmccormick commented on Jan 22, 2026

    @kdmccormick
    Member

    Thanks for the updates @salman2013 . Can you confirm that we will be removing the legacy view of the course discussion tab (mentioned here) and thus do not need to factor that into the strategy for this extraction?

  11. salman2013 commented on Jan 23, 2026

    @salman2013
    Author

    @kdmccormick Yes, we will remove the legacy course-level discussion tab and will not refactor any code within it, as outlined in [DEPR]: Non-MFE course tab interface for discussions.
    At this time, there is no direct blocker or dependency between this removal and the discussion block extraction. Therefore, the team has decided to defer this work and address it after the extraction effort is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions