Skip to content

Commit dcd7c1b

Browse files
author
Andrii
committed
refactor: move DEFAULT_ADVANCED_MODULES to hardcoded list instead of settings
1 parent 94c37e9 commit dcd7c1b

4 files changed

Lines changed: 14 additions & 27 deletions

File tree

cms/djangoapps/contentstore/views/component.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@
8282
"edit-title-button", "edit-upstream-alert",
8383
]
8484

85+
DEFAULT_ADVANCED_MODULES = [
86+
'google-calendar',
87+
'google-document',
88+
'lti_consumer',
89+
'poll',
90+
'split_test',
91+
'survey',
92+
'word_cloud',
93+
]
94+
8595

8696
def _advanced_component_types(show_unsupported):
8797
"""
@@ -445,7 +455,7 @@ def create_support_legend_dict():
445455
# These modules should be specified as a list of strings, where the strings
446456
# are the names of the modules in ADVANCED_COMPONENT_TYPES that should be
447457
# enabled for the course.
448-
course_advanced_keys = list(dict.fromkeys(courselike.advanced_modules + settings.DEFAULT_ADVANCED_MODULES))
458+
course_advanced_keys = list(dict.fromkeys(courselike.advanced_modules + DEFAULT_ADVANCED_MODULES))
449459
advanced_component_templates = {
450460
"type": "advanced",
451461
"templates": [],

cms/djangoapps/contentstore/views/tests/test_block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration
7676
from openedx.core.djangoapps.content_tagging import api as tagging_api
7777

78-
from ..component import component_handler, get_component_templates
78+
from ..component import component_handler, DEFAULT_ADVANCED_MODULES, get_component_templates
7979
from cms.djangoapps.contentstore.xblock_storage_handlers.view_handlers import (
8080
ALWAYS,
8181
VisibilityState,
@@ -2970,7 +2970,7 @@ def test_basic_components(self):
29702970
# Check for default advanced modules
29712971
advanced_templates = self.get_templates_of_type("advanced")
29722972
advanced_module_keys = [t['category'] for t in advanced_templates]
2973-
self.assertCountEqual(advanced_module_keys, settings.DEFAULT_ADVANCED_MODULES)
2973+
self.assertCountEqual(advanced_module_keys, DEFAULT_ADVANCED_MODULES)
29742974

29752975
# Now fully disable video through XBlockConfiguration
29762976
XBlockConfiguration.objects.create(name="video", enabled=False)
@@ -3019,7 +3019,7 @@ def test_advanced_components(self):
30193019
Test the handling of advanced component templates.
30203020
"""
30213021
self.course.advanced_modules.append("done")
3022-
EXPECTED_ADVANCED_MODULES_LENGTH = len(settings.DEFAULT_ADVANCED_MODULES) + 1
3022+
EXPECTED_ADVANCED_MODULES_LENGTH = len(DEFAULT_ADVANCED_MODULES) + 1
30233023
self.templates = get_component_templates(self.course)
30243024
advanced_templates = self.get_templates_of_type("advanced")
30253025
self.assertEqual(len(advanced_templates), EXPECTED_ADVANCED_MODULES_LENGTH)

cms/envs/common.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,16 +2938,3 @@ def _should_send_learning_badge_events(settings):
29382938
'survey',
29392939
'word_cloud',
29402940
]
2941-
2942-
# .. setting_name: DEFAULT_ADVANCED_MODULES
2943-
# .. setting_default: ['google-calendar', 'google-document', 'lti_consumer', 'poll', 'split_test', 'survey', 'word_cloud']
2944-
# .. setting_description: List of advanced modules that are enabled by default
2945-
DEFAULT_ADVANCED_MODULES = [
2946-
'google-calendar',
2947-
'google-document',
2948-
'lti_consumer',
2949-
'poll',
2950-
'split_test',
2951-
'survey',
2952-
'word_cloud',
2953-
]

cms/envs/test.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,3 @@
336336
OPENEDX_LEARNING = {
337337
"MEDIA": {"BACKEND": "django.core.files.storage.InMemoryStorage", "OPTIONS": {"location": MEDIA_ROOT + "_private"}}
338338
}
339-
340-
DEFAULT_ADVANCED_MODULES = [
341-
'google-calendar',
342-
'google-document',
343-
'lti_consumer',
344-
'poll',
345-
'split_test',
346-
'survey',
347-
'word_cloud',
348-
]

0 commit comments

Comments
 (0)