Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update languagae cookie with enterprise default language #2085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading