First PR to replace pytz with zoneinfo for UTC handling across codebase.
This PR migrates all UTC timezone handling from pytz to Python’s standard
library zoneinfo. The pytz library is now deprecated, and its documentation
recommends using zoneinfo for all new code. This update modernizes our
codebase, removes legacy pytz usage, and ensures compatibility with
current best practices for timezone management in Python 3.9+. No functional
changes to timezone logic - just a direct replacement for UTC handling.
https://github.com/openedx/edx-platform/issues/33980
This introduces the `ENFORCE_MASQUERADE_START_DATES` flag.
When the flag is disabled (default), masquerading users bypass start dates.
When the flag is enabled, masquerading users see the same start date
restrictions as regular students.
Currently, the sidebar relies only on the XBlock's `category` class attribute
(called `type` in the transformers). This behavior is inconsistent with the
legacy subsection navigation, which relies on the `XModuleMixin.get_icon_class`
method. This commit adds the `icon_class` to the fields collected by the
transformers and uses it to determine whether the "problem" or "video" icon
should be displayed for a unit in the sidebar.
We were running some tests using this function but it is not actually
used in the running application anymore so drop those tests and remove
the function in preparation for removing the legacy courseware itself.
* 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 https://github.com/openedx/frontend-app-learning/issues/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.
DEPR: https://github.com/openedx/edx-platform/issues/36429
This change removes the course_sock and related API data. The UI it
removes is on the Legacy Courseware pages which have also been replaced
and have their own [deprecation ticket](https://github.com/openedx/edx-platform/issues/35803)
Before this can be merged, we will need to update the
frontend-app-learning MFE to no longer consume the
`can_show_upgrade_sock` attribute.
BREAKING CHANGE: CourseHomeMetadata, ProgressTab, OutlineTab and
VerifiedMode APIs will no longer have a `can_show_upgrade_sock`
attribute.
We want to remove this page and URL endpoint so we're removing all the
references in the code that might point to this page. It was replaced
by the sequences page in the Learning MFE years ago but the old pages
were never cleaned up. We are replacing the calls with the URL for the
courseware in the learning MFE.
See https://github.com/openedx/edx-platform/issues/35803 for more
details.
* feat: update preview url to direct to mfe
* fix: use url builder instead of string formatter
* fix: url redirect for never published units
* fix: remove 404 error when not a preview or staff
* feat: update sequence metadata to allow draft branch
* feat: waffle based switch to ses for goal reminder email
* test: added test cases for ace message parameters
* feat: updated logic to specify channel name
* chore: update edx-ace version
* Revert "feat: remove `field-data` service from runtime initialization"
This reverts commit 6c435bb68c.
* Revert "feat: remove field data binding from the runtime"
This reverts commit 5f46ea52cd.
After changes from #31472, the user service of a "leaf" XBlock gets overridden
with the one created for its parent (SequenceBlock). Therefore, the
`requires_per_student_anonymous_id` is ignored in these XBlocks. The
subsequent renders of an XBlock (e.g., when requesting the solution) use
the student-specific IDs.
This removes choosing the proper ID (course-specific or student-specific) from
the runtime initialization. Instead, both IDs are passed to the user service.
There are only two XBlocks that relied on the
`requires_per_student_anonymous_id` - `ProblemBlock` and `HtmlBlock`. They
now request the "deprecated" (student-specific) user ID directly from the user
service.