Skip to content

Commit 36dd03f

Browse files
refactor: Only display Preview Language Setting (dark_lang) in LMS (#38510)
Co-Authored-By: Kyle D McCormick <kyle@axim.org>
1 parent da61d21 commit 36dd03f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

cms/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.conf.urls.static import static
88
from django.contrib import admin
99
from django.contrib.admin import autodiscover as django_autodiscover
10+
from django.shortcuts import redirect
1011
from django.urls import include, path, re_path
1112
from django.utils.translation import gettext_lazy as _
1213
from django.views.generic import RedirectView
@@ -86,7 +87,7 @@
8687
),
8788

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

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

openedx/core/djangoapps/dark_lang/tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
with_site_configuration,
1919
with_site_configuration_context,
2020
)
21-
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
21+
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
2222

2323
UNSET = object()
2424

@@ -259,6 +259,7 @@ def _post_clear_preview_lang(self):
259259
"""
260260
return self.client.post('/update_lang/', {'action': 'reset_preview_language'})
261261

262+
@skip_unless_lms
262263
def test_preview_lang_with_released_language(self):
263264
# Preview lang should always override selection
264265
self._post_set_preview_lang('rel')
@@ -272,6 +273,7 @@ def test_preview_lang_with_released_language(self):
272273
self.client.get('/home')
273274
self.assert_cookie_lang_equals('rel')
274275

276+
@skip_unless_lms
275277
def test_preview_lang_with_dark_language(self):
276278
self._post_set_preview_lang('unrel')
277279
self.client.get('/home')
@@ -290,6 +292,7 @@ def test_empty_preview_language(self):
290292
self.client.get('/home')
291293
self.assert_cookie_lang_equals('rel')
292294

295+
@skip_unless_lms
293296
def test_clear_lang(self):
294297
# Clear a language when no language was set
295298
self._post_clear_preview_lang()
@@ -335,6 +338,7 @@ def test_accept_chinese_language_codes(self):
335338
self.process_middleware_request(accept='zh-Hans;q=1.0, zh-Hant-TW;q=0.5, zh-HK;q=0.3')
336339
)
337340

341+
@skip_unless_lms
338342
def test_language_cookie_is_set(self):
339343
site_lang = settings.LANGUAGE_CODE
340344
url = '/dashboard'
@@ -370,6 +374,7 @@ def test_language_cookie_is_set(self):
370374
assert response.cookies.get(settings.LANGUAGE_COOKIE_NAME).value == ''
371375
assert response['Content-Language'] == site_lang
372376

377+
@skip_unless_lms
373378
@with_site_configuration(configuration={'LANGUAGE_CODE': 'es'})
374379
def test_preview_language_ignores_site_configuration(self):
375380
"""

0 commit comments

Comments
 (0)