-
Notifications
You must be signed in to change notification settings - Fork 8
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
Set session cookie for user's preferred language #1648
Conversation
9e01acc
to
870aaf9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1648 +/- ##
============================================
- Coverage 70.22% 70.20% -0.02%
+ Complexity 2007 2005 -2
============================================
Files 254 254
Lines 7902 7905 +3
Branches 745 744 -1
============================================
+ Hits 5549 5550 +1
Misses 2070 2070
- Partials 283 285 +2 ☔ View full report in Codecov by Sentry. |
@CookieValue(Constants.POSTGRES_DJANGO_SESSION_ID) String authToken, | ||
HttpServletRequest request) throws Exception { | ||
@CookieValue(Constants.POSTGRES_DJANGO_SESSION_ID) String authToken, | ||
@CookieValue(value = FORMPLAYER_SESSION_LANGUAGE, required = false) String sessionPrefLang, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Constants is already imported:
@CookieValue(value = FORMPLAYER_SESSION_LANGUAGE, required = false) String sessionPrefLang, | |
@CookieValue(Constants.FORMPLAYER_SESSION_LANGUAGE, required = false) String sessionPrefLang, |
if (sessionPrefLang == null || !sessionPrefLang.equals(sessionNavigationBean.getLocale())) { | ||
response.addCookie(new Cookie(FORMPLAYER_SESSION_LANGUAGE, sessionNavigationBean.getLocale())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow what's going on here. We're resetting the cookie value if it doesn't match what's being sent in the request body. But the value in the request body is coming from the cookie right (unless the cookie is empty in which case the first part of the condition is met)?
The decision was to use the localStorage instead of cookies, so this is no longer needed. |
Product Description
This PR sets a session cookie to store the user's preferred language for the current session. This cookie is to be used to override the user's favourite language in subsequent HTTP requests, making sure that the chosen language persists throughout the session.
This change also requires changes to the frontend, so another PR will be linked to this one.
Safety Assurance
Safety story
Automated test coverage
QA Plan
Special deploy instructions
Rollback instructions
Review