Skip to content

Commit 3dd8acc

Browse files
committed
feat: Only display Preview Language Setting (dark_lang) in LMS
Previously, there were two (identical) ways to preview dark language: 1. <CMS_ROOT_URL>/update_lang 2. <LMS_ROOT_URL>/update_lang Now, (1) will simply redirect to (2). So, the Preview Language Setting page will only render in an LMS context. This has no impact on end-user functionality. It has only a very minor UX end-user impact. The purpose of this is to allow us to completely retire the legacy Studio frontend without losing any end-user functionality. This page is not yet available in an MFE, which will need to be the eventual solution.
1 parent 18113c6 commit 3dd8acc

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

cms/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from django.urls import path, re_path
1010
from django.utils.translation import gettext_lazy as _
1111
from django.contrib import admin
12+
from django.shortcuts import redirect
1213
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
1314
from auth_backends.urls import oauth2_urlpatterns
1415
from edx_api_doc_tools import make_docs_urls
@@ -87,7 +88,7 @@
8788
),
8889

8990
# Darklang View to change the preview language (or dark language)
90-
path('update_lang/', include('openedx.core.djangoapps.dark_lang.urls', namespace='dark_lang')),
91+
path('update_lang/', lambda request: redirect(f'{settings.LMS_ROOT_URL}/update_lang/')),
9192

9293
# For redirecting to help pages.
9394
path('help_token/', include('help_tokens.urls')),

openedx/core/djangoapps/dark_lang/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ def _post_set_preview_lang(self, preview_language):
251251
"""
252252
Sends a post request to set the preview language
253253
"""
254+
# @@TODO make this call set_user_preference,
255+
# and then have a small separate LMS-only test class just to call the
256+
# POST and ensure it sets the user preference.
254257
return self.client.post('/update_lang/', {'preview_language': preview_language, 'action': 'set_preview_language'}) # lint-amnesty, pylint: disable=line-too-long
255258

256259
def _post_clear_preview_lang(self):

0 commit comments

Comments
 (0)