Skip to content

Conversation

@pomegranited
Copy link
Contributor

@pomegranited pomegranited commented Nov 18, 2021

Description

Re-submits the changes from https://github.com/edx/edx-platform/pull/28571 which were reverted by https://github.com/edx/edx-platform/pull/29341, and fixes the bug that caused this revert.

Builds on the shim added by https://github.com/edx/edx-platform/pull/28440 to deprecate the ModuleSystem.render_template attribute, in favor of using the added MakoService.render_template.

This change is only a refactoring, and should not affect Learners, Course Authors, or anyone else using edx-platform.

Supporting information

See https://github.com/edx/edx-platform/pull/28571#issuecomment-971893521 for details about why that PR was reverted. 343a182 adds a test for this issue, demonstrating that the new test fails, but is fixed by the subsequent commt 8c874c2.

See also:

Testing instructions

Sandbox provisioning:

LMS as learner:

  1. Login as a demo learner (honor@example.com / edx)
  2. Browse around the BD-13 test course and ensure that blocks render as expected, and that you can submit answers to problems. This course has all of the affected XBlocks in it, including an example Video block which shows the CC license wrapper (cf 7fd1467).
  3. Switch to the Legacy Course Experience and browse around in that too.

LMS as course staff:

  1. Login as a demo staff user (staff@example.com / edx)
  2. Navigate to a course and its Instructor Dashboard > Email tab
  3. Ensure that you can see and use the HTML WYSIWYG editor to craft emails to students. (cf 96d9208)

Studio:

  1. Login as a demo staff (staff@example.com / edx).
  2. Visit the BD-13 test course in Studio and browse through the blocks. Ensure they render and edit as expected.
  3. Check that you can submit answers to problems, and save changes to blocks.
  4. Preview unpublished changes and ensure they render as expected.
  5. Publish changes, and ensure they render in the LMS as expected.

Test the Studio visibility bug:

This bug occurs only in the XBlocks which do not @need("mako"), like ORA2.

For OpenCraft staff:

  • Appserver 2 contains the broken code, so you can verify the bug there.
  • Appserver 3 is running the fixed code on this branch, so you can activate that appserver to verify the bug is fixed.
  1. Login to Studio sandbox as a demo staff (staff@example.com / edx)
  2. Navigate to the BD-13 test course and locate the Complex blocks > ORA2 block.
  3. Click on the "cog" icon to edit the block visibility.
    If verifying the bug exists: note that an error is shown in studio, saying "Error: service 'mako' was not requested"
    If verifying that the bug is fixed: ensure that you can edit the block's visibility.

Deadline

None

in favor of the added MakoSystem render_template method.

Related changes:
* Adds the MakoService to the StudioEditModuleRuntime,
  PreviewModuleSystem, LmsModuleSystem, and XBlockRuntime
* MakoService constructor takes a `namespace_prefix` string, so that the
  CMS PreviewModuleSystem can render to LMS templates, without needing
  the special render_from_lms helper method.
* ModuleSystem.render_template becomes a read-only property, so the
  constructor calls and test module systems are updated accordingly.
* Adds tests for the MakoService and module system shims.

(cherry picked from commit 457f959)
The AuthoringMixin is automatically added to all XBlocks (see
settings.XBLOCK_MIXINS), and AuthoringMixin.visibility_view expects the
"mako" service.

This test verifies the bug by testing the PureXBlock, which does not
require the "mako" service, and so fails when the visibility_view is
rendered.
@openedx-webhooks
Copy link

openedx-webhooks commented Nov 18, 2021

Thanks for the pull request, @pomegranited! I've created BLENDED-1017 to keep track of it in Jira. More details are on the BD-13 project page.

When this pull request is ready, tag your edX technical lead.

@openedx-webhooks openedx-webhooks added blended PR is managed through 2U's blended developmnt program needs triage labels Nov 18, 2021
@pomegranited pomegranited marked this pull request as draft November 18, 2021 08:06
which fixes the visibility_view for XBlocks which don't explicitly
require the mako service.

Also removes the unneeded class property _services_requested from
AuthoringMixin and StudioEditableBlock. This property is better provided
by the XBlockMixin class.
@pomegranited pomegranited marked this pull request as ready for review November 19, 2021 00:24
Copy link
Contributor

@symbolist symbolist left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! That was a sneaky one.

  • I tested this as per instructions including the fix for the visibility settings.
  • I read through the code
  • I checked for accessibility issues. N/A
  • Includes documentation

@symbolist
Copy link
Contributor

Hi @jristau1984, my understanding from Dave Ormsbee is that your team is going to continue supporting the work on this epic. Will someone be available to merge this PR at an appropriate time and monitor its deployment? Thanks! 🙂

@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@jnlapierre jnlapierre self-requested a review November 29, 2021 19:38
Copy link
Contributor

@jnlapierre jnlapierre left a comment

Choose a reason for hiding this comment

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

LGTM

@jnlapierre jnlapierre merged commit ad5ad72 into openedx:master Nov 29, 2021
@openedx-webhooks
Copy link

@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

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

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@pomegranited pomegranited deleted the jill/bd-13-render_template-fix branch November 30, 2021 02:01
pomegranited added a commit to open-craft/openedx-platform that referenced this pull request Apr 21, 2022
…ring MFE

When the XBlock runtime is used in Studio/authoring mode, it needs to
use the template path prefix "lms." in order to locate the block
templates. (In LMS view, no prefix is required.)

Fixes bug introduced by openedx#29354
and removes template workaround added by
openedx#29517 (see Author Notes & Concerns)
jawad-khan pushed a commit that referenced this pull request Jun 14, 2022
…ring MFE

When the XBlock runtime is used in Studio/authoring mode, it needs to
use the template path prefix "lms." in order to locate the block
templates. (In LMS view, no prefix is required.)

Fixes bug introduced by #29354
and removes template workaround added by
#29517 (see Author Notes & Concerns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blended PR is managed through 2U's blended developmnt program merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants