From 159ac19f772bebe7a829cee51706eabe794defb0 Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Fri, 26 Jan 2024 11:42:43 -0500 Subject: [PATCH] feat: add pr suggestion logic --- openedx/core/djangoapps/lang_pref/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/lang_pref/middleware.py b/openedx/core/djangoapps/lang_pref/middleware.py index 7a8612e2097..d65b89c3a47 100644 --- a/openedx/core/djangoapps/lang_pref/middleware.py +++ b/openedx/core/djangoapps/lang_pref/middleware.py @@ -57,8 +57,8 @@ def process_request(self, request): if LANGUAGE_SESSION_KEY in request.session and request.session[LANGUAGE_SESSION_KEY] != cookie_lang: del request.session[LANGUAGE_SESSION_KEY] - # Apply language specified in SiteConfiguration, ignoring user preferences. - if (language := get_value('LANGUAGE_CODE')) and (getattr(settings, "IGNORE_USER_LANGUAGE_COOKIE", True)): + # Apply language specified in SiteConfiguration, if there are not user preferences. + if (language := get_value('LANGUAGE_CODE')) and (not request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME, None)): request.COOKIES[settings.LANGUAGE_COOKIE_NAME] = language def process_response(self, request, response): # lint-amnesty, pylint: disable=missing-function-docstring