Skip to content

Commit 0bb0849

Browse files
refactor: remove deprecated sidebar toggles
DEPR ticket: openedx/public-engineering#316
1 parent fd644d4 commit 0bb0849

File tree

3 files changed

+4
-171
lines changed

3 files changed

+4
-171
lines changed

lms/djangoapps/courseware/tests/test_views.py

Lines changed: 4 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@
7171
from lms.djangoapps.courseware.tests.helpers import MasqueradeMixin, get_expiration_banner_text
7272
from lms.djangoapps.courseware.testutils import RenderXBlockTestMixin
7373
from lms.djangoapps.courseware.toggles import (
74-
COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR,
75-
COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR,
7674
COURSEWARE_MICROFRONTEND_SEARCH_ENABLED,
7775
COURSEWARE_OPTIMIZED_RENDER_XBLOCK,
7876
)
@@ -3251,13 +3249,10 @@ def setUp(self):
32513249
self.client = APIClient()
32523250
self.apiUrl = reverse('courseware_navigation_sidebar_toggles_view', kwargs={'course_id': str(self.course.id)})
32533251

3254-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True)
3255-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False)
32563252
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False)
3257-
def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track_disabled(self):
3253+
def test_courseware_mfe_navigation_sidebar_completion_track_disabled(self):
32583254
"""
3259-
Getter to check if it is allowed to show the Courseware navigation sidebar to a user
3260-
and auxiliary sidebar doesn't open.
3255+
Getter to check if completion tracking is disabled.
32613256
"""
32623257
response = self.client.get(self.apiUrl, content_type='application/json')
32633258
body = json.loads(response.content.decode('utf-8'))
@@ -3266,19 +3261,14 @@ def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track
32663261
self.assertEqual(
32673262
body,
32683263
{
3269-
"enable_navigation_sidebar": True,
3270-
"always_open_auxiliary_sidebar": False,
32713264
"enable_completion_tracking": False,
32723265
},
32733266
)
32743267

3275-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True)
3276-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False)
32773268
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True)
3278-
def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track_enabled(self):
3269+
def test_courseware_mfe_navigation_sidebar_completion_track_enabled(self):
32793270
"""
3280-
Getter to check if it is allowed to show the Courseware navigation sidebar to a user
3281-
and auxiliary sidebar doesn't open.
3271+
Getter to check if completion tracking is enabled.
32823272
"""
32833273
response = self.client.get(self.apiUrl, content_type='application/json')
32843274
body = json.loads(response.content.decode('utf-8'))
@@ -3287,132 +3277,6 @@ def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track
32873277
self.assertEqual(
32883278
body,
32893279
{
3290-
"enable_navigation_sidebar": True,
3291-
"always_open_auxiliary_sidebar": False,
3292-
"enable_completion_tracking": True,
3293-
},
3294-
)
3295-
3296-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True)
3297-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True)
3298-
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False)
3299-
def test_courseware_mfe_navigation_sidebar_enabled_aux_enabled_completion_track_disabled(self):
3300-
"""
3301-
Getter to check if it is allowed to show the Courseware navigation sidebar to a user
3302-
and auxiliary sidebar should always open.
3303-
"""
3304-
response = self.client.get(self.apiUrl, content_type='application/json')
3305-
body = json.loads(response.content.decode('utf-8'))
3306-
3307-
self.assertEqual(response.status_code, 200)
3308-
self.assertEqual(
3309-
body,
3310-
{
3311-
"enable_navigation_sidebar": True,
3312-
"always_open_auxiliary_sidebar": True,
3313-
"enable_completion_tracking": False,
3314-
},
3315-
)
3316-
3317-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True)
3318-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True)
3319-
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True)
3320-
def test_courseware_mfe_navigation_sidebar_enabled_aux_enabled_completion_track_enabled(self):
3321-
"""
3322-
Getter to check if it is allowed to show the Courseware navigation sidebar to a user
3323-
and auxiliary sidebar should always open.
3324-
"""
3325-
response = self.client.get(self.apiUrl, content_type='application/json')
3326-
body = json.loads(response.content.decode('utf-8'))
3327-
3328-
self.assertEqual(response.status_code, 200)
3329-
self.assertEqual(
3330-
body,
3331-
{
3332-
"enable_navigation_sidebar": True,
3333-
"always_open_auxiliary_sidebar": True,
3334-
"enable_completion_tracking": True,
3335-
},
3336-
)
3337-
3338-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False)
3339-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True)
3340-
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False)
3341-
def test_courseware_mfe_navigation_sidebar_disabled_aux_enabled_completion_track_disabled(self):
3342-
"""
3343-
Getter to check if the Courseware navigation sidebar shouldn't be shown to a user
3344-
and auxiliary sidebar should always open.
3345-
"""
3346-
response = self.client.get(self.apiUrl, content_type='application/json')
3347-
body = json.loads(response.content.decode('utf-8'))
3348-
3349-
self.assertEqual(response.status_code, 200)
3350-
self.assertEqual(
3351-
body,
3352-
{
3353-
"enable_navigation_sidebar": False,
3354-
"always_open_auxiliary_sidebar": True,
3355-
"enable_completion_tracking": False,
3356-
},
3357-
)
3358-
3359-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False)
3360-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True)
3361-
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True)
3362-
def test_courseware_mfe_navigation_sidebar_disabled_aux_enabled_completion_track_enabled(self):
3363-
"""
3364-
Getter to check if the Courseware navigation sidebar shouldn't be shown to a user
3365-
and auxiliary sidebar should always open.
3366-
"""
3367-
response = self.client.get(self.apiUrl, content_type='application/json')
3368-
body = json.loads(response.content.decode('utf-8'))
3369-
3370-
self.assertEqual(response.status_code, 200)
3371-
self.assertEqual(
3372-
body,
3373-
{
3374-
"enable_navigation_sidebar": False,
3375-
"always_open_auxiliary_sidebar": True,
3376-
"enable_completion_tracking": True,
3377-
},
3378-
)
3379-
3380-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False)
3381-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False)
3382-
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False)
3383-
def test_courseware_mfe_navigation_sidebar_toggles_disabled_completion_track_disabled(self):
3384-
"""
3385-
Getter to check if neither navigation sidebar nor auxiliary sidebar is shown.
3386-
"""
3387-
response = self.client.get(self.apiUrl, content_type='application/json')
3388-
body = json.loads(response.content.decode('utf-8'))
3389-
3390-
self.assertEqual(response.status_code, 200)
3391-
self.assertEqual(
3392-
body,
3393-
{
3394-
"enable_navigation_sidebar": False,
3395-
"always_open_auxiliary_sidebar": False,
3396-
"enable_completion_tracking": False,
3397-
},
3398-
)
3399-
3400-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False)
3401-
@override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False)
3402-
@override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True)
3403-
def test_courseware_mfe_navigation_sidebar_toggles_disabled_completion_track_enabled(self):
3404-
"""
3405-
Getter to check if neither navigation sidebar nor auxiliary sidebar is shown.
3406-
"""
3407-
response = self.client.get(self.apiUrl, content_type='application/json')
3408-
body = json.loads(response.content.decode('utf-8'))
3409-
3410-
self.assertEqual(response.status_code, 200)
3411-
self.assertEqual(
3412-
body,
3413-
{
3414-
"enable_navigation_sidebar": False,
3415-
"always_open_auxiliary_sidebar": False,
34163280
"enable_completion_tracking": True,
34173281
},
34183282
)

lms/djangoapps/courseware/toggles.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,33 +83,6 @@
8383
f'{WAFFLE_FLAG_NAMESPACE}.disable_navigation_sidebar_blocks_caching', __name__
8484
)
8585

86-
# .. toggle_name: courseware.enable_navigation_sidebar
87-
# .. toggle_implementation: WaffleFlag
88-
# .. toggle_default: False
89-
# .. toggle_description: Enable navigation sidebar on Learning MFE
90-
# .. toggle_use_cases: opt_out, open_edx
91-
# .. toggle_creation_date: 2024-03-07
92-
# .. toggle_target_removal_date: None
93-
# .. toggle_tickets: FC-0056
94-
COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR = CourseWaffleFlag(
95-
f'{WAFFLE_FLAG_NAMESPACE}.enable_navigation_sidebar', __name__
96-
)
97-
98-
# .. toggle_name: courseware.always_open_auxiliary_sidebar
99-
# .. toggle_implementation: WaffleFlag
100-
# .. toggle_default: True
101-
# .. toggle_description: Waffle flag that determines whether the auxiliary sidebar,
102-
# such as discussion or notification, should automatically expand
103-
# on each course unit page within the Learning MFE, without preserving
104-
# the previous state of the sidebar.
105-
# .. toggle_use_cases: temporary
106-
# .. toggle_creation_date: 2024-04-28
107-
# .. toggle_target_removal_date: 2024-07-28
108-
# .. toggle_tickets: FC-0056
109-
COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR = CourseWaffleFlag(
110-
f'{WAFFLE_FLAG_NAMESPACE}.always_open_auxiliary_sidebar', __name__
111-
)
112-
11386
# .. toggle_name: courseware.mfe_progress_milestones_streak_discount_enabled
11487
# .. toggle_implementation: CourseWaffleFlag
11588
# .. toggle_default: False

lms/djangoapps/courseware/views/views.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@
101101
from lms.djangoapps.courseware.toggles import (
102102
course_is_invitation_only,
103103
courseware_mfe_search_is_enabled,
104-
COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR,
105-
COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR,
106104
)
107105
from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH
108106
from lms.djangoapps.courseware.user_state_client import DjangoXBlockUserStateClient
@@ -2398,8 +2396,6 @@ def courseware_mfe_navigation_sidebar_toggles(request, course_id=None):
23982396
return JsonResponse({"error": "Invalid course_id"})
23992397

24002398
return JsonResponse({
2401-
"enable_navigation_sidebar": COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR.is_enabled(course_key),
2402-
"always_open_auxiliary_sidebar": COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR.is_enabled(course_key),
24032399
# Add completion tracking status for the sidebar use while a global place for switches is put in place
24042400
"enable_completion_tracking": ENABLE_COMPLETION_TRACKING_SWITCH.is_enabled()
24052401
})

0 commit comments

Comments
 (0)