From 0c701cc1d02c3d3b630050a0547f9dc632596013 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
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/actions/global_actions.jsx | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

(limited to 'webapp/actions/global_actions.jsx')

diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index ed434fdc7..79706b594 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -379,7 +379,7 @@ export function newLocalizationSelected(locale) {
             translations: en
         });
     } else {
-        const localeInfo = I18n.getLanguageInfo(locale) || I18n.getLanguageInfo(global.window.mm_config.DefaultClientLocale);
+        const localeInfo = I18n.getLanguageInfo(locale);
 
         Client.getTranslations(
             localeInfo.url,
@@ -401,13 +401,23 @@ export function newLocalizationSelected(locale) {
     }
 }
 
+export function loadCurrentLocale() {
+    const user = UserStore.getCurrentUser();
+
+    if (user && user.locale) {
+        newLocalizationSelected(user.locale);
+    } else {
+        loadDefaultLocale();
+    }
+}
+
 export function loadDefaultLocale() {
-    const defaultLocale = global.window.mm_config.DefaultClientLocale;
-    let locale = global.window.mm_user ? global.window.mm_user.locale || defaultLocale : defaultLocale;
+    let locale = global.window.mm_config.DefaultClientLocale;
 
     if (!I18n.getLanguageInfo(locale)) {
         locale = 'en';
     }
+
     return newLocalizationSelected(locale);
 }
 
-- 
cgit v1.2.3-1-g7c22


From cd9015a967358975fb453cf115f011db2064777d Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Thu, 11 May 2017 08:11:12 -0400
Subject: Fix channels getting marked unread again on channel switch (#6390)

---
 webapp/actions/global_actions.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'webapp/actions/global_actions.jsx')

diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index 79706b594..3c88a7013 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -58,7 +58,7 @@ export function emitChannelClickEvent(channel) {
 
         getMyChannelMemberPromise.then(() => {
             getChannelStats(chan.id)(dispatch, getState);
-            viewChannel(chan.id)(dispatch, getState);
+            viewChannel(chan.id, oldChannelId)(dispatch, getState);
             loadPosts(chan.id);
 
             // Mark previous and next channel as read
-- 
cgit v1.2.3-1-g7c22

