Skip to content

Commit b1f01ed

Browse files
feanilkdmccormick
andauthored
feat!: Drop the legacy Tabs UI (openedx#37557)
This change drops the legacy studio custom pages UI aka. the tab edit page. This work is part of openedx#36108 BREAKING CHANGE: The 'legacy_studio.custom_pages' waffle flag has been removed and the code will work as if this flag is permanently set to False. Co-authored-by: Kyle McCormick <[email protected]>
1 parent d929cdb commit b1f01ed

File tree

18 files changed

+28
-912
lines changed

18 files changed

+28
-912
lines changed

cms/djangoapps/contentstore/rest_api/v0/views/tabs.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from common.djangoapps.student.auth import has_studio_read_access, has_studio_write_access
1414
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, verify_course_exists, view_auth_classes
1515
from ..serializers import CourseTabSerializer, CourseTabUpdateSerializer, TabIDLocatorSerializer
16-
from ....toggles import use_new_custom_pages
1716
from ....views.tabs import edit_tab_handler, get_course_tabs, reorder_tabs_handler
1817

1918

@@ -79,24 +78,20 @@ def get(self, request: Request, course_id: str) -> Response:
7978
```
8079
"""
8180
course_key = CourseKey.from_string(course_id)
82-
if not use_new_custom_pages(course_key):
83-
return Response(status=status.HTTP_403_FORBIDDEN)
8481
if not has_studio_read_access(request.user, course_key):
8582
self.permission_denied(request)
8683

8784
course_block = modulestore().get_course(course_key)
8885
tabs_to_render = get_course_tabs(course_block, request.user)
8986
serializedCourseTabs = CourseTabSerializer(tabs_to_render, many=True).data
90-
if use_new_custom_pages(course_key):
91-
json_tabs = []
92-
for tab in serializedCourseTabs:
93-
if tab.get('type') == 'static_tab':
94-
url_slug = tab.get('settings').get('url_slug')
95-
static_tab_loc = course_block.id.make_usage_key("static_tab", url_slug)
96-
tab["id"] = str(static_tab_loc)
97-
json_tabs.append(tab)
98-
return Response(json_tabs)
99-
return Response(serializedCourseTabs)
87+
json_tabs = []
88+
for tab in serializedCourseTabs:
89+
if tab.get('type') == 'static_tab':
90+
url_slug = tab.get('settings').get('url_slug')
91+
static_tab_loc = course_block.id.make_usage_key("static_tab", url_slug)
92+
tab["id"] = str(static_tab_loc)
93+
json_tabs.append(tab)
94+
return Response(json_tabs)
10095

10196

10297
@view_auth_classes(is_authenticated=True)

cms/djangoapps/contentstore/rest_api/v1/serializers/course_waffle_flags.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ def get_use_new_home_page(self, obj):
5252

5353
def get_use_new_custom_pages(self, obj):
5454
"""
55-
Method to get the use_new_custom_pages switch
55+
Method to indicate whether or not to use the new custom pages
56+
57+
This used to be based on a waffle flag but the flag is being removed so we
58+
default it to true for now until we can remove the need for it from the consumers
59+
of this serializer and the related APIs.
60+
61+
See https://github.com/openedx/edx-platform/issues/37497
5662
"""
57-
course_key = self.get_course_key()
58-
return toggles.use_new_custom_pages(course_key)
63+
return True
5964

6065
def get_use_new_schedule_details_page(self, obj):
6166
"""

cms/djangoapps/contentstore/tests/test_contentstore.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,8 +1498,6 @@ def test_get_json(handler):
14981498
test_get_html('export_handler')
14991499
with override_waffle_flag(toggles.LEGACY_STUDIO_COURSE_TEAM, True):
15001500
test_get_html('course_team_handler')
1501-
with override_waffle_flag(toggles.LEGACY_STUDIO_CUSTOM_PAGES, True):
1502-
test_get_html('tabs_handler')
15031501
with override_waffle_flag(toggles.LEGACY_STUDIO_SCHEDULE_DETAILS, True):
15041502
test_get_html('settings_handler')
15051503
with override_waffle_flag(toggles.LEGACY_STUDIO_GRADING, True):
@@ -1518,6 +1516,11 @@ def test_get_json(handler):
15181516
resp = self.client.get(course_updates_url)
15191517
assert resp.status_code == 200
15201518

1519+
resp = self.client.get(
1520+
get_url('cms.djangoapps.contentstore:v0:course_tab_list', course_key, 'course_id')
1521+
)
1522+
self.assertEqual(resp.status_code, 200)
1523+
15211524
# go look at the Edit page
15221525
unit_key = course_key.make_usage_key('vertical', 'test_vertical')
15231526
with override_waffle_flag(toggles.LEGACY_STUDIO_UNIT_EDITOR, True):

cms/djangoapps/contentstore/tests/test_course_settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def test_discussion_fields_available(self, is_pages_and_resources_enabled,
167167
@override_waffle_flag(toggles.LEGACY_STUDIO_IMPORT, True)
168168
@override_waffle_flag(toggles.LEGACY_STUDIO_EXPORT, True)
169169
@override_waffle_flag(toggles.LEGACY_STUDIO_COURSE_TEAM, True)
170-
@override_waffle_flag(toggles.LEGACY_STUDIO_CUSTOM_PAGES, True)
171170
@override_waffle_flag(toggles.LEGACY_STUDIO_SCHEDULE_DETAILS, True)
172171
@override_waffle_flag(toggles.LEGACY_STUDIO_GRADING, True)
173172
def test_disable_advanced_settings_feature(self, disable_advanced_settings):
@@ -184,7 +183,6 @@ def test_disable_advanced_settings_feature(self, disable_advanced_settings):
184183
'import_handler',
185184
'export_handler',
186185
'course_team_handler',
187-
'tabs_handler',
188186
'settings_handler',
189187
'grading_handler',
190188
):

cms/djangoapps/contentstore/toggles.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,25 +162,6 @@ def individualize_anonymous_user_id(course_id):
162162
return INDIVIDUALIZE_ANONYMOUS_USER_ID.is_enabled(course_id)
163163

164164

165-
# .. toggle_name: legacy_studio.custom_pages
166-
# .. toggle_implementation: WaffleFlag
167-
# .. toggle_default: False
168-
# .. toggle_description: Temporarily fall back to the old Studio custom pages tab.
169-
# .. toggle_use_cases: temporary
170-
# .. toggle_creation_date: 2025-03-14
171-
# .. toggle_target_removal_date: 2025-09-14
172-
# .. toggle_tickets: https://github.com/openedx/edx-platform/issues/36275
173-
# .. toggle_warning: In Ulmo, this toggle will be removed. Only the new (React-based) experience will be available.
174-
LEGACY_STUDIO_CUSTOM_PAGES = CourseWaffleFlag("legacy_studio.custom_pages", __name__)
175-
176-
177-
def use_new_custom_pages(course_key):
178-
"""
179-
Returns a boolean if new studio custom pages mfe is enabled
180-
"""
181-
return not LEGACY_STUDIO_CUSTOM_PAGES.is_enabled(course_key)
182-
183-
184165
# .. toggle_name: contentstore.use_react_markdown_editor
185166
# .. toggle_implementation: CourseWaffleFlag
186167
# .. toggle_default: False

cms/djangoapps/contentstore/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
use_new_advanced_settings_page,
4545
use_new_certificates_page,
4646
use_new_course_team_page,
47-
use_new_custom_pages,
4847
use_new_export_page,
4948
use_new_grading_page,
5049
use_new_group_configurations_page,
@@ -514,11 +513,10 @@ def get_custom_pages_url(course_locator) -> str:
514513
Gets course authoring microfrontend URL for custom pages view.
515514
"""
516515
custom_pages_url = None
517-
if use_new_custom_pages(course_locator):
518-
mfe_base_url = get_course_authoring_url(course_locator)
519-
course_mfe_url = f'{mfe_base_url}/course/{course_locator}/custom-pages'
520-
if mfe_base_url:
521-
custom_pages_url = course_mfe_url
516+
mfe_base_url = get_course_authoring_url(course_locator)
517+
course_mfe_url = f'{mfe_base_url}/course/{course_locator}/custom-pages'
518+
if mfe_base_url:
519+
custom_pages_url = course_mfe_url
522520
return custom_pages_url
523521

524522

cms/djangoapps/contentstore/views/tabs.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
from xmodule.modulestore.django import modulestore
1818
from xmodule.tabs import CourseTab, CourseTabList, InvalidTabsException, StaticTab
1919

20-
from common.djangoapps.edxmako.shortcuts import render_to_response
2120
from common.djangoapps.student.auth import has_course_author_access
2221
from common.djangoapps.util.json_request import JsonResponse, JsonResponseBadRequest, expect_json
23-
from ..toggles import use_new_custom_pages
24-
from ..utils import get_lms_link_for_item, get_pages_and_resources_url, get_custom_pages_url
22+
from ..utils import get_pages_and_resources_url, get_custom_pages_url
2523

2624
__all__ = ["tabs_handler", "update_tabs_handler"]
2725

@@ -65,18 +63,7 @@ def tabs_handler(request, course_key_string):
6563
elif request.method == "GET": # assume html
6664
# get all tabs from the tabs list: static tabs (a.k.a. user-created tabs) and built-in tabs
6765
# present in the same order they are displayed in LMS
68-
if use_new_custom_pages(course_key):
69-
return redirect(get_custom_pages_url(course_key))
70-
tabs_to_render = list(get_course_tabs(course_item, request.user))
71-
72-
return render_to_response(
73-
"edit-tabs.html",
74-
{
75-
"context_course": course_item,
76-
"tabs_to_render": tabs_to_render,
77-
"lms_link": get_lms_link_for_item(course_item.location),
78-
},
79-
)
66+
return redirect(get_custom_pages_url(course_key))
8067
else:
8168
return HttpResponseNotFound()
8269

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import json
55
import random
66

7-
from edx_toggles.toggles.testutils import override_waffle_flag
8-
9-
from cms.djangoapps.contentstore import toggles
107
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
118
from cms.djangoapps.contentstore.utils import reverse_course_url
129
from cms.djangoapps.contentstore.views import tabs
@@ -68,12 +65,11 @@ def test_not_implemented(self):
6865
data={'invalid_request': None},
6966
)
7067

71-
@override_waffle_flag(toggles.LEGACY_STUDIO_CUSTOM_PAGES, True)
7268
def test_view_index(self):
7369
"""Basic check that the Pages page responds correctly"""
7470

7571
resp = self.client.get_html(self.url)
76-
self.assertContains(resp, 'course-nav-list')
72+
assert resp.status_code == 302
7773

7874
def test_reorder_tabs(self):
7975
"""Test re-ordering of tabs"""

cms/static/cms/js/spec/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@
242242
'js/spec/video/transcripts/editor_spec',
243243
'js/spec/video/transcripts/file_uploader_spec',
244244
'js/spec/models/component_template_spec',
245-
'js/spec/models/explicit_url_spec',
246245
'js/spec/models/xblock_info_spec',
247246
'js/spec/models/xblock_validation_spec',
248247
'js/spec/models/license_spec',

cms/static/js/factories/edit_tabs.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)