Skip to content

Commit

Permalink
fix: update langugae cookie with enterprise default language
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad-ammar committed Apr 25, 2024
1 parent 833f5d7 commit b6830d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Change Log
Unreleased
----------
[4.16.5]
--------
* fix: update langugae cookie with enterprise default language

[4.16.4]
--------
* revert: fix: set default langauge for all learners linked with an enteprise customer
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.16.4"
__version__ = "4.16.5"
5 changes: 4 additions & 1 deletion enterprise/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Middleware for enterprise app.
"""

from django.conf import settings
from django.utils.deprecation import MiddlewareMixin

from enterprise.utils import get_enterprise_customer_for_user
Expand Down Expand Up @@ -70,4 +71,6 @@ def process_request(self, request):
# then set the default language as the learner's language
if not user_pref and not is_request_from_mobile_app(request):
# pylint: disable=protected-access
request._anonymous_user_cookie_lang = enterprise_customer.default_language
default_language = enterprise_customer.default_language
request._anonymous_user_cookie_lang = default_language
request.COOKIES[settings.LANGUAGE_COOKIE_NAME] = default_language
3 changes: 2 additions & 1 deletion enterprise/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def root(*args):
'SAP': 1,
}

LANGUAGE_COOKIE = 'openedx-language-preference'
LANGUAGE_COOKIE_NAME = "openedx-language-preference"
SHARED_COOKIE_DOMAIN = ''

ENTERPRISE_BACKEND_SERVICE_EDX_OAUTH2_PROVIDER_URL = f'{LMS_INTERNAL_ROOT_URL}/oauth2'
ENTERPRISE_BACKEND_SERVICE_EDX_OAUTH2_KEY = 'test_backend_oauth2_key'
Expand Down

0 comments on commit b6830d0

Please sign in to comment.