refactor: move waffle flag calculation to utils file and other updates

This commit is contained in:
SaadYousaf
2021-06-21 22:08:49 +05:00
parent 90921e19e2
commit 608f1994b7
6 changed files with 30 additions and 16 deletions

View File

@@ -29,12 +29,12 @@ OVERRIDE_DISCUSSION_LEGACY_SETTINGS_FLAG = CourseWaffleFlag(
# .. toggle_name: discussions.pages_and_resources_mfe
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Waffle flag to link existing studio views to the new Pages and Resources experience.
# .. toggle_description: Waffle flag to enable new Pages and Resources experience for course.
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2021-05-24
# .. toggle_target_removal_date: 2021-12-31
# .. toggle_warnings: Also set settings.COURSE_AUTHORING_MICROFRONTEND_URL.
# .. toggle_tickets: None
# .. toggle_tickets: https://openedx.atlassian.net/browse/TNL-7791
ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND = CourseWaffleFlag(
waffle_namespace=WAFFLE_NAMESPACE,
flag_name='pages_and_resources_mfe',

View File

@@ -0,0 +1,16 @@
"""
Utils methods for Discussion app waffle flags.
"""
from openedx.core.djangoapps.discussions.config.waffle import (
ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND,
OVERRIDE_DISCUSSION_LEGACY_SETTINGS_FLAG
)
def legacy_discussion_experience_enabled(course_key):
"""
Checks for relevant flags and returns a boolean whether to show legacy discussion settings or not
"""
return bool(OVERRIDE_DISCUSSION_LEGACY_SETTINGS_FLAG.is_enabled(course_key) or
not ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND.is_enabled(course_key))