-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat!: Remove Legacy Preview Functionality #36460
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
Conversation
4f9b60b to
5ee3ecd
Compare
32bd1ab to
1829eb7
Compare
5ee3ecd to
9215044
Compare
9215044 to
7a16b64
Compare
ormsbee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions and minor requests.
| assert not bool(access.has_access(self.student, 'load', self.course, course_key=self.course.id)) | ||
|
|
||
| # Student should be able to load the course even if they don't have staff access. | ||
| assert bool(access.has_access(self.student, 'load', self.course, course_key=self.course.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this behavior change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously this test was being run with the preview domain where the student would indeed not have access. Now that the test is being run on the default domain, the student does have access again.
|
|
||
|
|
||
| @set_preview_mode(True) | ||
| @patch('lms.djangoapps.courseware.views.index.CoursewareIndex._redirect_to_learning_mfe', return_value=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining why this patch exists here.
| with patch('lms.djangoapps.courseware.access.in_preview_mode') as mock_preview: | ||
| mock_preview.return_value = True | ||
| for obj in modules: | ||
| assert not bool(access.has_access(self.student, 'load', obj, course_key=self.course.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an equivalent test to make sure that students cannot load the preview/draft state of unreleased content if they know the correct URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to add a check that a student will not have access to the unpublished content when this is not published yet.
There are a few more mentions but these are all the ones that don't need major further followup. BREAKING CHANGE: The learning MFE now supports preview functionality natively and it is no longer necessary to use a different domain on the LMS to render a preview of course content. See openedx/frontend-app-learning#1455 for more details.
Since we're no longer using a separate domain, that check always returned false. Remove it and update any places/tests where it is used.
With the removal of the preview check this function is also a no-op now so drop calls to it and update the places where it is called to not change other behavior.
The CoursewareIndex view is going to be removed eventually but for now we're focusing on removing the PREVIEW_LMS_BASE setting. With this change, if someone tries to load the legacy courseware URL from the preview domain it will no longer redirect them to the MFE preview. This is not a problem that will occur for users coming from existing studio links because those links have already been updated to go directly to the new urls. The only way this path could execute is if someone goes directly to the old Preview URL that they saved off platform somewhere. eg. If they bookmarked it for some reason. BREAKING CHANGE: Saved links (including bookmarks) to the legacy preview URLs will no longer redirect to the MFE preview URLs.
This test helper was setting the preview mode for tests by changing the hostname that was set while tests were running. This was mostly not being used to test preview but to run a bunch of legacy courseware tests while defaulting to the new learning MFE for the courseware. This commit updates various tests in the `courseware` app to not rely on the fact that we're in preview to test legacy courseware behavior and instead directly patches either the `_redirect_to_learning_mfe` function or uses the `_get_legacy_courseware_url` or both to be able to have the tests continue to test the legacy coursewary. This will hopefully make the tests more accuarte even though hopefully we'll just be removing many of them soon as a part of the legacy courseware cleanup. We're just doing the preview removal separately to reduce the number of things that are changing at once.
With the other recent cleanup, this function is no longer being referenced by anything so we can just drop it.
7a16b64 to
6e5db47
Compare
Ensure that students can't get access to unpublished content.
fdae7b8 to
4865cab
Compare
feanil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ormsbee I've responded to the comments, please have another look when you have a moment.
| with patch('lms.djangoapps.courseware.access.in_preview_mode') as mock_preview: | ||
| mock_preview.return_value = True | ||
| for obj in modules: | ||
| assert not bool(access.has_access(self.student, 'load', obj, course_key=self.course.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to add a check that a student will not have access to the unpublished content when this is not published yet.
| print(self.store.get_branch_setting()) | ||
|
|
||
| print(self.store.get_branch_setting()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover debug code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, I'll clean this up before squashing.
ormsbee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the print statements, this looks good to squash and merge.
Also remove some errant debugging print statements.
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
|
2U Release Notice: This PR has been deployed to the edX production environment. |
closes overhangio#1231 The preview page has been migrated to the Learning MFE as of openedx/openedx-platform#36460 This is why we dont need to have a separate domain for the preview site anymore nor the configuration setting for the preview page in core.
closes #1231 The preview page has been migrated to the Learning MFE as of openedx/openedx-platform#36460 This is why we dont need to have a separate domain for the preview site anymore nor the configuration setting for the preview page in core.
closes #1231 The preview page has been migrated to the Learning MFE as of openedx/openedx-platform#36460 This is why we dont need to have a separate domain for the preview site anymore nor the configuration setting for the preview page in core.
* feat!: Remove all trivial mentions of PREVIEW_LMS_BASE There are a few more mentions but these are all the ones that don't need major further followup. BREAKING CHANGE: The learning MFE now supports preview functionality natively and it is no longer necessary to use a different domain on the LMS to render a preview of course content. See openedx/frontend-app-learning#1455 for more details. * feat: Drop the `in_preview_mode` function. Since we're no longer using a separate domain, that check always returned false. Remove it and update any places/tests where it is used. * feat: Drop courseware_mfe_is_active function. With the removal of the preview check this function is also a no-op now so drop calls to it and update the places where it is called to not change other behavior. * feat!: Drop redirect to preview from the legacy courseware index. The CoursewareIndex view is going to be removed eventually but for now we're focusing on removing the PREVIEW_LMS_BASE setting. With this change, if someone tries to load the legacy courseware URL from the preview domain it will no longer redirect them to the MFE preview. This is not a problem that will occur for users coming from existing studio links because those links have already been updated to go directly to the new urls. The only way this path could execute is if someone goes directly to the old Preview URL that they saved off platform somewhere. eg. If they bookmarked it for some reason. BREAKING CHANGE: Saved links (including bookmarks) to the legacy preview URLs will no longer redirect to the MFE preview URLs. * test: Drop the set_preview_mode test helper. This test helper was setting the preview mode for tests by changing the hostname that was set while tests were running. This was mostly not being used to test preview but to run a bunch of legacy courseware tests while defaulting to the new learning MFE for the courseware. This commit updates various tests in the `courseware` app to not rely on the fact that we're in preview to test legacy courseware behavior and instead directly patches either the `_redirect_to_learning_mfe` function or uses the `_get_legacy_courseware_url` or both to be able to have the tests continue to test the legacy coursewary. This will hopefully make the tests more accuarte even though hopefully we'll just be removing many of them soon as a part of the legacy courseware cleanup. We're just doing the preview removal separately to reduce the number of things that are changing at once. * test: Drop the `_get_urls_function` With the other recent cleanup, this function is no longer being referenced by anything so we can just drop it. * test: Test student access to unpublihsed content. Ensure that students can't get access to unpublished content.
We haven't done anything specila for lms-xml for over a decade and we dropped lms-preview support last year when we added preview capabality to the new Authoring MFE. #36460
We haven't done anything specila for lms-xml for over a decade and we dropped lms-preview support last year when we added preview capabality to the new Authoring MFE. #36460
We haven't done anything specila for lms-xml for over a decade and we dropped lms-preview support last year when we added preview capabality to the new Authoring MFE. openedx#36460
BREAKING CHANGE: The learning MFE now supports preview functionality natively and it is no longer necessary to use a different domain on the LMS to render a preview of course content. Visiting the preview domain will no longer give you a different view of the course content.
See openedx/frontend-app-learning#1455 for more details.
This PR removes the legacy functionality, a side-effect of this is that saved links (including bookmarks) to the legacy preview URLs will not redirect to the MFE preview URLs as mentions of that domain have been removed.
This PR depends on #36436 and #36430 to merge first.