feat: Add CourseWaffleFlag for overriding course discussion settings for legacy experience.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
26
openedx/core/djangoapps/discussions/config/waffle.py
Normal file
26
openedx/core/djangoapps/discussions/config/waffle.py
Normal file
@@ -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__,
|
||||
)
|
||||
Reference in New Issue
Block a user