Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/3] refactor: remove XModule JS from Django Pipeline #32530

Merged

Conversation

kdmccormick
Copy link
Member

@kdmccormick kdmccormick commented Jun 21, 2023

Part of a series of PRs:

The next one is:

Description & Supporting Information

module-js and module-descriptor-js are old JavaScript group indicators, left over from when we managed XModule assets via Django Pipeline. We would like to get rid of them in order to make it easier to build XModule JS without using Python.

There is one single usage of module-js in the entire platform (the rest have been replaced with Webpack references, which is the less-outdated way of managing XModule assets :). The lone module-js reference was added in 2013 [1] so that circuit diagrams would display in the course wiki. However, the ability to render circuits in the wiki was removed in 2015 [2], so it is safe to remove the reference.

There is also one single usage of module-descriptor-js. It's in the legacy bulk email editor, which hackily cribs from the old HtmlBlock editor. Fortunately, we are able to simply replace the Django Pipeline reference with the equivalent XModule JS Webpack bundle. (Note: The old email editor is currently still supported, but is currently being replaced by frontend-app-communications, so this hack will be gone eventually).

Finally, this commit also sneaks in one styling fix: it adds the HtmlBlockEditor CSS back to the aforementioned legacy bulk email page. The missing CSS was causing a read-only 1-line codemirror editor to appear below the HTML editor [3]. This bug was introduced during the original XModule SCSS decoupling [4], which removed builtin block CSS from the LMS-wide bundle, thus removing the HTML editor CSS from the bulk email page. We imagine that nobody noticed because the bug only exists in master (not Palm) and frontend-app-communications seems to be globally enabled on edx.org. As a simple fix, we add the new CSS link to the legacy bulk email page, and it renders fine again [5].

References:

  1. 3fc59b3

  2. Remove circuit djangoapp from LMS #10324

  3. Before fix:
    image

  4. Decouple XModule styles from LMS/Studio styles #32018

  5. After fix:
    image

Part of: #32481

Testing

Here's how I tested:

Prereqs

  • Tutor Nighly provisioned, demo course imported, and two users created (one admin, one not):

    tutor local launch
    tutor local do importdemocourse
    tutor local do createuser admin [email protected] --password admin --staff --superuser
    tutor local do createuser kyle [email protected] --password kyle
  • Write a plugin to disable the new bulk email experience. Save this to "$(tutor plugins printroot)/legacybulkemail.py":

    from tutor import hooks
    hooks.Filters.ENV_PATCHES.add_item((
     "openedx-lms-common-settings",
        "FEATURES['ENABLE_NEW_BULK_EMAIL_EXPERIENCE'] = False"
    ), priority=90)  # low priority so that it overrides tutor-mfe's settings patch
  • Build & run this branch, plus your plugin:

    tutor local stop
    tutor plugins enable legacybulkemail
    tutor config save --set EDX_PLATFORM_REPOSITORY=https://github.com/kdmccormick/edx-platform
    tutor config save --set EDX_PLATFORM_VERSION=kdmccormick/xmodule-js-pre-cleanup
    tutor images build openedx
    tutor local start -d
    
  • Log out of LMS if you're logged in.

Set up a student to receive bulk email

Enable bulk email

  • Log back in, this time with your admin creds.
  • Go to "Bulk email flags" in the LMS admin panel: http://local.overhang.io/admin/bulk_email/bulkemailflag/
  • Click "Add Bulk Email Flag"
  • Check "Enabled" and un-check "Require course email auth". Save.
  • Bulk email is now enabled globally.

Smoke test legacy bulk email

  • Go to the demo course's email page on the instructor dashboard: http://local.overhang.io/courses/course-v1:edX+DemoX+Demo_Course/instructor#view-send_email
    • This should show you to a legacy LMS HTML editor, served from a URL like http://local.overhang.io/course/..... If it tries to send you to the "New Experience", then stop, something is wrong.
  • In the legacy email editor, write a bulk email. Add some bold, italic, etc. Send it to All Learners.
  • Check your real email inbox, and confirm that you received the message with the expected formatting.

Enable the course wiki:

Smoke-test the wiki, which no longer has unnecessary built-in XBlock JS:

@kdmccormick kdmccormick force-pushed the kdmccormick/xmodule-js-pre-cleanup branch from ca78b05 to 3b89711 Compare June 21, 2023 16:18
@kdmccormick kdmccormick force-pushed the kdmccormick/xmodule-js-pre-cleanup branch 3 times, most recently from 8e3296d to 0ffebad Compare July 6, 2023 16:09
@kdmccormick kdmccormick changed the title refactor: remove XModule JS from Django Pipeline (WIP) refactor: remove XModule JS from Django Pipeline Jul 6, 2023
@kdmccormick kdmccormick force-pushed the kdmccormick/xmodule-js-pre-cleanup branch from 0ffebad to 17faca5 Compare July 7, 2023 16:23
@kdmccormick kdmccormick marked this pull request as ready for review July 7, 2023 16:52
@kdmccormick
Copy link
Member Author

@andrey-canon Now that the Sass is simplified, I'm working to simplify the XModule JS. This PR is ready if you have the time to review.

@kdmccormick kdmccormick changed the title refactor: remove XModule JS from Django Pipeline [1/3] refactor: remove XModule JS from Django Pipeline Jul 7, 2023
@kdmccormick kdmccormick force-pushed the kdmccormick/xmodule-js-pre-cleanup branch from 17faca5 to e0c73a4 Compare July 10, 2023 21:27
@andrey-canon
Copy link
Contributor

Hi @kdmccormick, I was testing the bulk email part and I couldn't replicate your results

This is what I got with master
image

vs your branch

image

I don't know if something is missing in the instructions or if that is an error

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to test this locally and everything looks like it works as expected:
image

@andrey-canon
Copy link
Contributor

Hi @kdmccormick, I was testing the bulk email part and I couldn't replicate your results

This is what I got with master image

vs your branch

image

I don't know if something is missing in the instructions or if that is an error

@kdmccormick my mistake since my volume didn't have the last xmodule changes, I ran the openedx-assets xmodule and openedx-assets common but I forgot to run openedx-assets webpack --env=prod, now it's working

image

@kdmccormick
Copy link
Member Author

Nice, thanks guys.

Blocked on merging this currently due to some possible regressions from my last PR.

@kdmccormick kdmccormick force-pushed the kdmccormick/xmodule-js-pre-cleanup branch from e0c73a4 to 323dab1 Compare July 14, 2023 18:53
`module-js` and `module-descriptor-js` are old JavaScript group
indicators, left over from when we managed XModule assets via Django
Pipeline. We would like to get rid of them in order to make it easier to
build XModule JS without using Python.

There is one single usage of `module-js` in the entire platform (the
rest have been replaced with Webpack references, which is the
less-outdated way of managing XModule assets :). The lone `module-js`
reference was added in 2013 [1] so that circuit diagrams would display
in the course wiki. However, the ability to render circuits in the wiki
was removed in 2015 [2], so it is safe to remove the reference.

There is also one single usage of `module-descriptor-js`. It's in the
legacy bulk email editor, which hackily cribs from the old HtmlBlock
editor. Fortunately, we are able to simply replace the Django Pipeline
reference with the equivalent XModule JS Webpack bundle. (Note: The old
email editor is currently still supported, but is currently being
replaced by frontend-app-communications, so this hack will be gone
eventually).

Finally, this commit also sneaks in one styling fix: it adds the
HtmlBlockEditor CSS back to the aforementioned legacy bulk email page.
The missing CSS was causing a read-only 1-line codemirror editor to
appear below the HTML editor [3]. This bug was introduced during the
original XModule SCSS decoupling [4], which removed builtin block CSS
from the LMS-wide bundle, thus removing the HTML editor CSS from the
bulk email page. We imagine that nobody noticed because the bug only
exists in master (not Palm) and frontend-app-communications seems to be
globally enabled on edx.org. As a simple fix, we add the new CSS link to
the legacy bulk email page, and it renders fine again [5].

References:

1. openedx@3fc59b3
2. openedx#10324
3. Before fix: https://github.com/openedx/edx-platform/assets/3628148/25fc41b2-403d-4339-8c49-0b04664dfa02
4. openedx#32018
5. After fix: https://github.com/openedx/edx-platform/assets/3628148/9a5d74f1-cc83-4ebe-8f0c-ee270f7721b8

Part of: openedx#32481
@kdmccormick kdmccormick force-pushed the kdmccormick/xmodule-js-pre-cleanup branch from 323dab1 to 41e7ae4 Compare July 17, 2023 17:35
@kdmccormick kdmccormick merged commit 4aedeb8 into openedx:master Jul 18, 2023
42 checks passed
@kdmccormick kdmccormick deleted the kdmccormick/xmodule-js-pre-cleanup branch July 18, 2023 13:32
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants