From 0c701cc1d02c3d3b630050a0547f9dc632596013 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 9 May 2017 16:00:40 -0400 Subject: PLT-6518 Fixed user's locale not being loaded with redux actions (#6359) * Stopped ManageLanguages component from mutating user * Removed obsolete reference to mm_user * PLT-6518 Fixed user's locale not being loaded with redux actions --- webapp/components/login/login_controller.jsx | 2 +- webapp/components/root.jsx | 6 +++--- webapp/components/user_settings/manage_languages.jsx | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx index fa3412f34..04ba46896 100644 --- a/webapp/components/login/login_controller.jsx +++ b/webapp/components/login/login_controller.jsx @@ -210,7 +210,7 @@ export default class LoginController extends React.Component { finishSignin(team) { const query = this.props.location.query; - GlobalActions.loadDefaultLocale(); + GlobalActions.loadCurrentLocale(); if (query.redirect_to) { browserHistory.push(query.redirect_to); } else if (team) { diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx index 6907e84e4..701ee6e80 100644 --- a/webapp/components/root.jsx +++ b/webapp/components/root.jsx @@ -20,8 +20,8 @@ export default class Root extends React.Component { constructor(props) { super(props); this.state = { - locale: 'en', - translations: null + locale: LocalizationStore.getLocale(), + translations: LocalizationStore.getTranslations() }; this.localizationChanged = this.localizationChanged.bind(this); @@ -113,7 +113,7 @@ export default class Root extends React.Component { LocalizationStore.addChangeListener(this.localizationChanged); // Get our localizaiton - GlobalActions.loadDefaultLocale(); + GlobalActions.loadCurrentLocale(); } componentWillUnmount() { diff --git a/webapp/components/user_settings/manage_languages.jsx b/webapp/components/user_settings/manage_languages.jsx index b88485110..09b32e1d7 100644 --- a/webapp/components/user_settings/manage_languages.jsx +++ b/webapp/components/user_settings/manage_languages.jsx @@ -33,12 +33,10 @@ export default class ManageLanguage extends React.Component { changeLanguage(e) { e.preventDefault(); - var user = this.props.user; - var locale = this.state.locale; - - user.locale = locale; - - this.submitUser(user); + this.submitUser({ + ...this.props.user, + locale: this.state.locale + }); } submitUser(user) { updateUser(user, Constants.UserUpdateEvents.LANGUAGE, -- cgit v1.2.3-1-g7c22