From 0152617d3da7ba30344ed79b37031c9e1ad07f1b Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Tue, 27 Feb 2024 09:12:16 -0500 Subject: [PATCH 1/9] feat: create a new setting USE_DISCUSSIONS_MFE_FRONTEND --- lms/djangoapps/discussion/plugins.py | 3 ++- lms/djangoapps/discussion/views.py | 9 ++++++--- openedx/core/djangoapps/discussions/utils.py | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/discussion/plugins.py b/lms/djangoapps/discussion/plugins.py index 83f929b1c72..05404b17f37 100644 --- a/lms/djangoapps/discussion/plugins.py +++ b/lms/djangoapps/discussion/plugins.py @@ -10,6 +10,7 @@ from lms.djangoapps.discussion.toggles import ENABLE_DISCUSSIONS_MFE from openedx.core.djangoapps.discussions.url_helpers import get_discussions_mfe_url +from openedx.core.djangoapps.discussions.utils import use_discussions_mfe from xmodule.tabs import TabFragmentViewMixin import lms.djangoapps.discussion.django_comment_client.utils as utils @@ -44,7 +45,7 @@ def is_enabled(cls, course, user=None): @property def link_func(self): def _link_func(course, reverse_func): - if ENABLE_DISCUSSIONS_MFE.is_enabled(course.id): + if ENABLE_DISCUSSIONS_MFE.is_enabled(course.id) and use_discussions_mfe(course.org): return get_discussions_mfe_url(course_key=course.id) return reverse('forum_form_discussion', args=[str(course.id)]) diff --git a/lms/djangoapps/discussion/views.py b/lms/djangoapps/discussion/views.py index 74a365bcdf8..5c111bfbbd1 100644 --- a/lms/djangoapps/discussion/views.py +++ b/lms/djangoapps/discussion/views.py @@ -54,7 +54,8 @@ available_division_schemes, get_discussion_categories_ids, get_divided_discussions, - get_group_names_by_id + get_group_names_by_id, + use_discussions_mfe ) from openedx.core.djangoapps.django_comment_common.models import ( FORUM_ROLE_ADMINISTRATOR, @@ -271,9 +272,10 @@ def redirect_forum_url_to_new_mfe(request, course_id): """ course_key = CourseKey.from_string(course_id) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) + course = get_course_with_access(request.user, 'load', course_key) redirect_url = None - if discussions_mfe_enabled: + if discussions_mfe_enabled and use_discussions_mfe(course.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL redirect_url = f"{mfe_base_url}/{str(course_key)}" return redirect_url @@ -333,7 +335,8 @@ def redirect_thread_url_to_new_mfe(request, course_id, thread_id): course_key = CourseKey.from_string(course_id) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) redirect_url = None - if discussions_mfe_enabled: + course = get_course_with_access(request.user, 'load', course_key) + if discussions_mfe_enabled and use_discussions_mfe(course.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL if thread_id: redirect_url = f"{mfe_base_url}/{str(course_key)}/posts/{thread_id}" diff --git a/openedx/core/djangoapps/discussions/utils.py b/openedx/core/djangoapps/discussions/utils.py index 7c26a4e482e..6af8811aec4 100644 --- a/openedx/core/djangoapps/discussions/utils.py +++ b/openedx/core/djangoapps/discussions/utils.py @@ -17,6 +17,7 @@ from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, Group # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions_service import PartitionService # lint-amnesty, pylint: disable=wrong-import-order +from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers log = logging.getLogger(__name__) @@ -191,3 +192,18 @@ def get_course_division_scheme(course_discussion_settings: CourseDiscussionSetti ): division_scheme = CourseDiscussionSettings.NONE return division_scheme + + +def use_discussions_mfe(org) -> bool: + """ + Checks with the org if the tenant enables the + Discussions MFE. + Returns: + True if the MFE setting is activated, by default + the MFE is deactivated + """ + use_discussions_mfe = configuration_helpers.get_value_for_org( + org, "USE_DISCUSSIONS_MFE_FRONTEND", False + ) + + return bool(use_discussions_mfe) \ No newline at end of file From d490965932ed949943124bf37e0946d2dc510906 Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Wed, 28 Feb 2024 17:58:17 -0500 Subject: [PATCH 2/9] feat: add new setting USE_DISCUSSIONS_MFE_FRONTEND --- lms/djangoapps/discussion/rest_api/api.py | 7 +++++-- lms/djangoapps/discussion/views.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py index f480fb31fe2..70f2f876a25 100644 --- a/lms/djangoapps/discussion/rest_api/api.py +++ b/lms/djangoapps/discussion/rest_api/api.py @@ -41,7 +41,10 @@ from lms.djangoapps.discussion.toggles_utils import reported_content_email_notification_enabled from lms.djangoapps.discussion.views import is_privileged_user from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration, DiscussionTopicLink, Provider -from openedx.core.djangoapps.discussions.utils import get_accessible_discussion_xblocks +from openedx.core.djangoapps.discussions.utils import ( + get_accessible_discussion_xblocks, + use_discussions_mfe +) from openedx.core.djangoapps.django_comment_common import comment_client from openedx.core.djangoapps.django_comment_common.comment_client.comment import Comment from openedx.core.djangoapps.django_comment_common.comment_client.course import ( @@ -1351,7 +1354,7 @@ def _handle_abuse_flagged_field(form_value, user, cc_content, request): if form_value: cc_content.flagAbuse(user, cc_content) track_discussion_reported_event(request, course, cc_content) - if ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) and reported_content_email_notification_enabled( + if ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) and use_discussions_mfe(course.org) and reported_content_email_notification_enabled( course_key): if cc_content.type == 'thread': thread_flagged.send(sender='flag_abuse_for_thread', user=user, post=cc_content) diff --git a/lms/djangoapps/discussion/views.py b/lms/djangoapps/discussion/views.py index 5c111bfbbd1..27e244930e0 100644 --- a/lms/djangoapps/discussion/views.py +++ b/lms/djangoapps/discussion/views.py @@ -655,8 +655,9 @@ def user_profile(request, course_key, user_id): 'annotated_content_info': context['annotated_content_info'], }) else: + course = get_course_with_access(request.user, 'load', course_key) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) - if discussions_mfe_enabled: + if discussions_mfe_enabled and use_discussions_mfe(course.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL return redirect(f"{mfe_base_url}/{str(course_key)}/learners") From 4e1fcd702b9cdfc764063d26a843f2d58bc76b6f Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Wed, 28 Feb 2024 18:59:13 -0500 Subject: [PATCH 3/9] fix: quality checks --- lms/djangoapps/discussion/rest_api/api.py | 5 +++-- openedx/core/djangoapps/discussions/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py index 70f2f876a25..34521c8b86c 100644 --- a/lms/djangoapps/discussion/rest_api/api.py +++ b/lms/djangoapps/discussion/rest_api/api.py @@ -1354,8 +1354,9 @@ def _handle_abuse_flagged_field(form_value, user, cc_content, request): if form_value: cc_content.flagAbuse(user, cc_content) track_discussion_reported_event(request, course, cc_content) - if ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) and use_discussions_mfe(course.org) and reported_content_email_notification_enabled( - course_key): + if ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) and use_discussions_mfe( + course.org) and reported_content_email_notification_enabled( + course_key): if cc_content.type == 'thread': thread_flagged.send(sender='flag_abuse_for_thread', user=user, post=cc_content) else: diff --git a/openedx/core/djangoapps/discussions/utils.py b/openedx/core/djangoapps/discussions/utils.py index 6af8811aec4..8fd8807c2ac 100644 --- a/openedx/core/djangoapps/discussions/utils.py +++ b/openedx/core/djangoapps/discussions/utils.py @@ -202,8 +202,8 @@ def use_discussions_mfe(org) -> bool: True if the MFE setting is activated, by default the MFE is deactivated """ - use_discussions_mfe = configuration_helpers.get_value_for_org( + use_discussions = configuration_helpers.get_value_for_org( org, "USE_DISCUSSIONS_MFE_FRONTEND", False ) - return bool(use_discussions_mfe) \ No newline at end of file + return bool(use_discussions) From 6ec4dfb0654679db4e372f943c4fe7a58b48cea9 Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Fri, 1 Mar 2024 17:16:52 -0500 Subject: [PATCH 4/9] fix: add setting override --- lms/djangoapps/discussion/tests/test_views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/discussion/tests/test_views.py b/lms/djangoapps/discussion/tests/test_views.py index 6b7f2de3ee5..f9f758a01e7 100644 --- a/lms/djangoapps/discussion/tests/test_views.py +++ b/lms/djangoapps/discussion/tests/test_views.py @@ -2287,7 +2287,7 @@ def setUp(self): self.staff_user = AdminFactory.create() CourseEnrollmentFactory.create(user=self.user, course_id=self.course.id) - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url") + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND="true") def test_redirect_from_legacy_base_url_to_new_experience(self): """ Verify that the legacy url is redirected to MFE homepage when @@ -2302,7 +2302,7 @@ def test_redirect_from_legacy_base_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url") + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND="true") def test_redirect_from_legacy_profile_url_to_new_experience(self): """ Verify that the requested user profile is redirected to MFE learners tab when @@ -2317,7 +2317,7 @@ def test_redirect_from_legacy_profile_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}/learners" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url") + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND="true") def test_redirect_from_legacy_single_thread_to_new_experience(self): """ Verify that a legacy single url is redirected to corresponding MFE thread url when the ENABLE_DISCUSSIONS_MFE From c5ba9a5582625e27523c380757340eb2ab43ac42 Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Mon, 4 Mar 2024 08:54:08 -0500 Subject: [PATCH 5/9] fix: add setting override --- lms/djangoapps/discussion/tests/test_views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/discussion/tests/test_views.py b/lms/djangoapps/discussion/tests/test_views.py index f9f758a01e7..58a05b671d0 100644 --- a/lms/djangoapps/discussion/tests/test_views.py +++ b/lms/djangoapps/discussion/tests/test_views.py @@ -2287,7 +2287,7 @@ def setUp(self): self.staff_user = AdminFactory.create() CourseEnrollmentFactory.create(user=self.user, course_id=self.course.id) - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND="true") + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND=True) def test_redirect_from_legacy_base_url_to_new_experience(self): """ Verify that the legacy url is redirected to MFE homepage when @@ -2302,7 +2302,7 @@ def test_redirect_from_legacy_base_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND="true") + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND=True) def test_redirect_from_legacy_profile_url_to_new_experience(self): """ Verify that the requested user profile is redirected to MFE learners tab when @@ -2317,7 +2317,7 @@ def test_redirect_from_legacy_profile_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}/learners" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND="true") + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND=True) def test_redirect_from_legacy_single_thread_to_new_experience(self): """ Verify that a legacy single url is redirected to corresponding MFE thread url when the ENABLE_DISCUSSIONS_MFE From 34e4606d7b405534d8687d2c6a28b56e873e238a Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Tue, 5 Mar 2024 11:14:57 -0500 Subject: [PATCH 6/9] fix: add setting override --- lms/djangoapps/courseware/tests/test_tabs.py | 2 +- lms/djangoapps/discussion/tests/test_views.py | 9 ++++++--- lms/djangoapps/discussion/views.py | 10 ++++------ openedx/core/djangoapps/discussions/utils.py | 7 ++++++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index db59fa373bc..93251e2471d 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -839,7 +839,7 @@ def test_tab_link(self, toggle_enabled): else: expected_link = reverse("forum_form_discussion", args=[str(self.course.id)]) - with self.settings(FEATURES={'ENABLE_DISCUSSION_SERVICE': True}): + with self.settings(FEATURES={'ENABLE_DISCUSSION_SERVICE': True, 'ENABLE_MFE_FOR_TESTING': True}): with override_waffle_flag(ENABLE_DISCUSSIONS_MFE, toggle_enabled): self.check_discussion( tab_list=self.tabs_with_discussion, diff --git a/lms/djangoapps/discussion/tests/test_views.py b/lms/djangoapps/discussion/tests/test_views.py index 58a05b671d0..a3515fe0c5c 100644 --- a/lms/djangoapps/discussion/tests/test_views.py +++ b/lms/djangoapps/discussion/tests/test_views.py @@ -2280,6 +2280,9 @@ class ForumMFETestCase(ForumsEnableMixin, SharedModuleStoreTestCase): Tests that the MFE upgrade banner and MFE is shown in the correct situation with the correct UI """ + features_with_enable_mfe_settings = settings.FEATURES.copy() + features_with_enable_mfe_settings['ENABLE_MFE_FOR_TESTING']=True + def setUp(self): super().setUp() self.course = CourseFactory.create() @@ -2287,7 +2290,7 @@ def setUp(self): self.staff_user = AdminFactory.create() CourseEnrollmentFactory.create(user=self.user, course_id=self.course.id) - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND=True) + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=features_with_enable_mfe_settings) def test_redirect_from_legacy_base_url_to_new_experience(self): """ Verify that the legacy url is redirected to MFE homepage when @@ -2302,7 +2305,7 @@ def test_redirect_from_legacy_base_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND=True) + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=features_with_enable_mfe_settings) def test_redirect_from_legacy_profile_url_to_new_experience(self): """ Verify that the requested user profile is redirected to MFE learners tab when @@ -2317,7 +2320,7 @@ def test_redirect_from_legacy_profile_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}/learners" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", USE_DISCUSSIONS_MFE_FRONTEND=True) + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=features_with_enable_mfe_settings) def test_redirect_from_legacy_single_thread_to_new_experience(self): """ Verify that a legacy single url is redirected to corresponding MFE thread url when the ENABLE_DISCUSSIONS_MFE diff --git a/lms/djangoapps/discussion/views.py b/lms/djangoapps/discussion/views.py index 27e244930e0..d7645bcbf16 100644 --- a/lms/djangoapps/discussion/views.py +++ b/lms/djangoapps/discussion/views.py @@ -272,10 +272,9 @@ def redirect_forum_url_to_new_mfe(request, course_id): """ course_key = CourseKey.from_string(course_id) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) - course = get_course_with_access(request.user, 'load', course_key) redirect_url = None - if discussions_mfe_enabled and use_discussions_mfe(course.org): + if discussions_mfe_enabled and use_discussions_mfe(course_key.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL redirect_url = f"{mfe_base_url}/{str(course_key)}" return redirect_url @@ -335,8 +334,8 @@ def redirect_thread_url_to_new_mfe(request, course_id, thread_id): course_key = CourseKey.from_string(course_id) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) redirect_url = None - course = get_course_with_access(request.user, 'load', course_key) - if discussions_mfe_enabled and use_discussions_mfe(course.org): + + if discussions_mfe_enabled and use_discussions_mfe(course_key.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL if thread_id: redirect_url = f"{mfe_base_url}/{str(course_key)}/posts/{thread_id}" @@ -655,9 +654,8 @@ def user_profile(request, course_key, user_id): 'annotated_content_info': context['annotated_content_info'], }) else: - course = get_course_with_access(request.user, 'load', course_key) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) - if discussions_mfe_enabled and use_discussions_mfe(course.org): + if discussions_mfe_enabled and use_discussions_mfe(course_key.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL return redirect(f"{mfe_base_url}/{str(course_key)}/learners") diff --git a/openedx/core/djangoapps/discussions/utils.py b/openedx/core/djangoapps/discussions/utils.py index 8fd8807c2ac..b67ab9127fa 100644 --- a/openedx/core/djangoapps/discussions/utils.py +++ b/openedx/core/djangoapps/discussions/utils.py @@ -18,6 +18,7 @@ from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, Group # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions_service import PartitionService # lint-amnesty, pylint: disable=wrong-import-order from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers +from edx_toggles.toggles import SettingDictToggle log = logging.getLogger(__name__) @@ -202,8 +203,12 @@ def use_discussions_mfe(org) -> bool: True if the MFE setting is activated, by default the MFE is deactivated """ + ENABLE_MFE_FOR_TESTING = SettingDictToggle( + "FEATURES", "ENABLE_MFE_FOR_TESTING", default=False, module_name=__name__ + ).is_enabled() + use_discussions = configuration_helpers.get_value_for_org( - org, "USE_DISCUSSIONS_MFE_FRONTEND", False + org, "USE_DISCUSSIONS_MFE_FRONTEND", ENABLE_MFE_FOR_TESTING or False ) return bool(use_discussions) From d9203d6a6469b179bd13aa1fb179f717f8128b2b Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Tue, 5 Mar 2024 11:24:44 -0500 Subject: [PATCH 7/9] fix: pep 8 violations --- lms/djangoapps/discussion/tests/test_views.py | 2 +- lms/djangoapps/discussion/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/discussion/tests/test_views.py b/lms/djangoapps/discussion/tests/test_views.py index a3515fe0c5c..f6a602cbb45 100644 --- a/lms/djangoapps/discussion/tests/test_views.py +++ b/lms/djangoapps/discussion/tests/test_views.py @@ -2281,7 +2281,7 @@ class ForumMFETestCase(ForumsEnableMixin, SharedModuleStoreTestCase): """ features_with_enable_mfe_settings = settings.FEATURES.copy() - features_with_enable_mfe_settings['ENABLE_MFE_FOR_TESTING']=True + features_with_enable_mfe_settings['ENABLE_MFE_FOR_TESTING'] = True def setUp(self): super().setUp() diff --git a/lms/djangoapps/discussion/views.py b/lms/djangoapps/discussion/views.py index d7645bcbf16..458afd89525 100644 --- a/lms/djangoapps/discussion/views.py +++ b/lms/djangoapps/discussion/views.py @@ -334,7 +334,7 @@ def redirect_thread_url_to_new_mfe(request, course_id, thread_id): course_key = CourseKey.from_string(course_id) discussions_mfe_enabled = ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) redirect_url = None - + if discussions_mfe_enabled and use_discussions_mfe(course_key.org): mfe_base_url = settings.DISCUSSIONS_MICROFRONTEND_URL if thread_id: From 14c0d311aefec87f10ff59a82a2174e733ef6093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Felipe=20Casta=C3=B1o?= <78836902+luisfelipec95@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:08:38 -0500 Subject: [PATCH 8/9] fix: update setting name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Brayan CerĂ³n <86393372+bra-i-am@users.noreply.github.com> --- openedx/core/djangoapps/discussions/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/discussions/utils.py b/openedx/core/djangoapps/discussions/utils.py index b67ab9127fa..4646ed5db05 100644 --- a/openedx/core/djangoapps/discussions/utils.py +++ b/openedx/core/djangoapps/discussions/utils.py @@ -208,7 +208,7 @@ def use_discussions_mfe(org) -> bool: ).is_enabled() use_discussions = configuration_helpers.get_value_for_org( - org, "USE_DISCUSSIONS_MFE_FRONTEND", ENABLE_MFE_FOR_TESTING or False + org, "USE_DISCUSSIONS_MFE", ENABLE_MFE_FOR_TESTING or False ) return bool(use_discussions) From 877ba07194ee0f206171822bf83a9cbec93f37a5 Mon Sep 17 00:00:00 2001 From: Luis Felipe Castano Date: Tue, 5 Mar 2024 17:11:12 -0500 Subject: [PATCH 9/9] fix: change variable name --- lms/djangoapps/discussion/tests/test_views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/discussion/tests/test_views.py b/lms/djangoapps/discussion/tests/test_views.py index f6a602cbb45..05f582fa152 100644 --- a/lms/djangoapps/discussion/tests/test_views.py +++ b/lms/djangoapps/discussion/tests/test_views.py @@ -2280,8 +2280,8 @@ class ForumMFETestCase(ForumsEnableMixin, SharedModuleStoreTestCase): Tests that the MFE upgrade banner and MFE is shown in the correct situation with the correct UI """ - features_with_enable_mfe_settings = settings.FEATURES.copy() - features_with_enable_mfe_settings['ENABLE_MFE_FOR_TESTING'] = True + FEATURES_WITH_DISCUSSION_MFE_ENABLED = settings.FEATURES.copy() + FEATURES_WITH_DISCUSSION_MFE_ENABLED['ENABLE_MFE_FOR_TESTING'] = True def setUp(self): super().setUp() @@ -2290,7 +2290,7 @@ def setUp(self): self.staff_user = AdminFactory.create() CourseEnrollmentFactory.create(user=self.user, course_id=self.course.id) - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=features_with_enable_mfe_settings) + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=FEATURES_WITH_DISCUSSION_MFE_ENABLED) def test_redirect_from_legacy_base_url_to_new_experience(self): """ Verify that the legacy url is redirected to MFE homepage when @@ -2305,7 +2305,7 @@ def test_redirect_from_legacy_base_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=features_with_enable_mfe_settings) + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=FEATURES_WITH_DISCUSSION_MFE_ENABLED) def test_redirect_from_legacy_profile_url_to_new_experience(self): """ Verify that the requested user profile is redirected to MFE learners tab when @@ -2320,7 +2320,7 @@ def test_redirect_from_legacy_profile_url_to_new_experience(self): expected_url = f"{settings.DISCUSSIONS_MICROFRONTEND_URL}/{str(self.course.id)}/learners" assert response.url == expected_url - @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=features_with_enable_mfe_settings) + @override_settings(DISCUSSIONS_MICROFRONTEND_URL="http://test.url", FEATURES=FEATURES_WITH_DISCUSSION_MFE_ENABLED) def test_redirect_from_legacy_single_thread_to_new_experience(self): """ Verify that a legacy single url is redirected to corresponding MFE thread url when the ENABLE_DISCUSSIONS_MFE