diff --git a/cms/djangoapps/models/settings/course_metadata.py b/cms/djangoapps/models/settings/course_metadata.py index f00ca35287..d62ebb01cd 100644 --- a/cms/djangoapps/models/settings/course_metadata.py +++ b/cms/djangoapps/models/settings/course_metadata.py @@ -13,7 +13,9 @@ from django.utils.translation import ugettext as _ from xblock.fields import Scope from cms.djangoapps.contentstore import toggles +from cms.djangoapps.contentstore.config.waffle import ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND from common.djangoapps.xblock_django.models import XBlockStudioConfigurationFlag +from openedx.core.djangoapps.discussions.config.waffle import OVERRIDE_DISCUSSION_LEGACY_SETTINGS_FLAG from openedx.core.lib.teams_config import TeamsetType from openedx.features.course_experience import COURSE_ENABLE_UNENROLLED_ACCESS_FLAG from xmodule.modulestore.django import modulestore @@ -141,6 +143,13 @@ class CourseMetadata: if not settings.PROCTORING_BACKENDS or settings.PROCTORING_BACKENDS.get('proctortrack') is None: exclude_list.append('proctoring_escalation_email') + if (ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND.is_enabled(course_key) and + not OVERRIDE_DISCUSSION_LEGACY_SETTINGS_FLAG.is_enabled(course_key)): + exclude_list.append('discussion_blackouts') + exclude_list.append('allow_anonymous') + exclude_list.append('allow_anonymous_to_peers') + exclude_list.append('discussion_topics') + return exclude_list @classmethod diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 99ecd484a8..4aa30c7583 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -27,6 +27,7 @@ from opaque_keys.edx.keys import CourseKey from xblock.field_data import DictFieldData from xblock.fields import ScopeIds +from cms.djangoapps.contentstore.config.waffle import ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND from common.djangoapps.course_modes.models import CourseMode, CourseModesArchive from common.djangoapps.edxmako.shortcuts import render_to_response from common.djangoapps.student.models import CourseEnrollment @@ -133,13 +134,16 @@ def instructor_dashboard_2(request, course_id): # lint-amnesty, pylint: disable sections = [] if access['staff']: - sections.extend([ + sections_content = [ _section_course_info(course, access), _section_membership(course, access), _section_cohort_management(course, access), - _section_discussions_management(course, access), _section_student_admin(course, access), - ]) + ] + if not ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND.is_enabled(course_key): + sections_content.append(_section_discussions_management(course, access)) + sections.extend(sections_content) + if access['data_researcher']: sections.append(_section_data_download(course, access)) diff --git a/openedx/core/djangoapps/discussions/config/__init__.py b/openedx/core/djangoapps/discussions/config/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openedx/core/djangoapps/discussions/config/waffle.py b/openedx/core/djangoapps/discussions/config/waffle.py new file mode 100644 index 0000000000..565cb16e3f --- /dev/null +++ b/openedx/core/djangoapps/discussions/config/waffle.py @@ -0,0 +1,26 @@ +""" +This module contains various configuration settings via +waffle switches for the discussions app. +""" + +from edx_toggles.toggles import LegacyWaffleFlagNamespace + +from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag + + +WAFFLE_DISCUSSION_LEGACY_SETTINGS_NAMESPACE = LegacyWaffleFlagNamespace(name='discussions') + +# .. toggle_name: discussions.override_discussion_legacy_settings +# .. toggle_implementation: CourseWaffleFlag +# .. toggle_default: False +# .. toggle_description: Waffle flag to override visibility of discussion settings for legacy experience. +# .. toggle_use_cases: temporary, open_edx +# .. toggle_creation_date: 2021-06-15 +# .. toggle_target_removal_date: 2021-12-31 +# .. toggle_warnings: Discussion settings will be visible when this flag is enabled with Pages & Resources flag enabled. +# .. toggle_tickets: https://openedx.atlassian.net/browse/TNL-8389 +OVERRIDE_DISCUSSION_LEGACY_SETTINGS_FLAG = CourseWaffleFlag( + waffle_namespace=WAFFLE_DISCUSSION_LEGACY_SETTINGS_NAMESPACE, + flag_name='override_discussion_legacy_settings', + module_name=__name__, +)