diff --git a/lms/djangoapps/course_home_api/toggles.py b/lms/djangoapps/course_home_api/toggles.py index 8c8b8ad2150..9d197fabb52 100644 --- a/lms/djangoapps/course_home_api/toggles.py +++ b/lms/djangoapps/course_home_api/toggles.py @@ -4,6 +4,7 @@ from edx_toggles.toggles import LegacyWaffleFlagNamespace +from lms.lib.utils import use_learning_legacy_frontend from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='course_home') @@ -26,7 +27,10 @@ def course_home_legacy_is_active(course_key): - return COURSE_HOME_USE_LEGACY_FRONTEND.is_enabled(course_key) or course_key.deprecated + return ( + use_learning_legacy_frontend() and + (COURSE_HOME_USE_LEGACY_FRONTEND.is_enabled(course_key) or course_key.deprecated) + ) def course_home_mfe_progress_tab_is_active(course_key): diff --git a/lms/djangoapps/courseware/toggles.py b/lms/djangoapps/courseware/toggles.py index 4cea39e09c0..8b1b826fc86 100644 --- a/lms/djangoapps/courseware/toggles.py +++ b/lms/djangoapps/courseware/toggles.py @@ -5,6 +5,7 @@ from edx_toggles.toggles import LegacyWaffleFlagNamespace, SettingToggle from opaque_keys.edx.keys import CourseKey +from lms.lib.utils import use_learning_legacy_frontend from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag # Namespace for courseware waffle flags. @@ -140,7 +141,7 @@ def courseware_mfe_is_active(course_key: CourseKey) -> bool: return False # NO: MFE courseware can be disabled for users/courses/globally via this # Waffle flag. - if COURSEWARE_USE_LEGACY_FRONTEND.is_enabled(course_key): + if use_learning_legacy_frontend() and COURSEWARE_USE_LEGACY_FRONTEND.is_enabled(course_key): return False # NO: Course preview doesn't work in the MFE if in_preview_mode(): diff --git a/lms/lib/utils.py b/lms/lib/utils.py index 93287337824..97fc35edd8b 100644 --- a/lms/lib/utils.py +++ b/lms/lib/utils.py @@ -2,6 +2,8 @@ Helper methods for the LMS. """ +from django.conf import settings + def get_parent_unit(xblock): """ @@ -44,3 +46,18 @@ def is_unit(xblock): """ return get_parent_unit(xblock) is None and xblock.get_parent() + + +def use_learning_legacy_frontend() -> bool: + """ + THIS WILL BE OBSOLETE FROM VERSIONS HIGHER THAN NUTMEG + https://docs.openedx.org/en/latest/community/release_notes/olive.html#learning-mfe-is-now-required + + Checks in django settings if use the learning legacy + frontend instead the learning mfe. + + Returns: + True if the legacy frontend setting is activated, by default + legacy would be activated. + """ + return bool(getattr(settings, "USE_LEARNING_LEGACY_FRONTEND", True)) diff --git a/requirements/edx/base.in b/requirements/edx/base.in index 34c0c79de1a..4299b86e8de 100644 --- a/requirements/edx/base.in +++ b/requirements/edx/base.in @@ -125,7 +125,7 @@ openedx-filters # Open edX Filters from Hooks Extension Fram ora2 piexif # Exif image metadata manipulation, used in the profile_images app Pillow # Image manipulation library; used for course assets, profile images, invoice PDFs, etc. -py2neo # Driver for converting Python modulestore structures to Neo4j's schema (for Coursegraph). +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz pycountry pycryptodomex pygments # Used to support colors in paver command output diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 61c5208e2e5..31918923c39 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -781,7 +781,7 @@ psutil==5.9.0 # via # -r requirements/edx/paver.txt # edx-django-utils -py2neo==2021.2.3 +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.in diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 0ba47d465f2..9471358d29b 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -1061,7 +1061,7 @@ py==1.11.0 # pytest # pytest-forked # tox -py2neo==2021.2.3 +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz # via # -c requirements/edx/../constraints.txt # -r requirements/edx/testing.txt diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 881a36d5b8c..db574874b97 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -998,7 +998,7 @@ py==1.11.0 # pytest # pytest-forked # tox -py2neo==2021.2.3 +py2neo @ https://github.com/overhangio/py2neo/releases/download/2021.2.3/py2neo-2021.2.3.tar.gz # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt