summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
authoratp <pruthvip15@gmail.com>2017-08-29 20:17:32 +0530
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-29 10:47:32 -0400
commit6a312b2ad4c1c50d082165c968fc5111a1a50d28 (patch)
tree520742bd05253d9091948ed7189366457e8a9ca8 /webapp/stores
parent257edc9ea3b25328aa44098e963815c3c3d25312 (diff)
downloadchat-6a312b2ad4c1c50d082165c968fc5111a1a50d28.tar.gz
chat-6a312b2ad4c1c50d082165c968fc5111a1a50d28.tar.bz2
chat-6a312b2ad4c1c50d082165c968fc5111a1a50d28.zip
PLT-3638: Fix re-opening of collapsed preview on refresh (#7301)
In this change, user action for toggling the preview is stored in the browser localstorage. Hence If there us a preview visibility value is present in the localstorage, that will be given the preference compared to the overall preview setting.
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/browser_store.jsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/webapp/stores/browser_store.jsx b/webapp/stores/browser_store.jsx
index 18fcc452d..a7c5294cd 100644
--- a/webapp/stores/browser_store.jsx
+++ b/webapp/stores/browser_store.jsx
@@ -6,8 +6,8 @@ import * as Utils from 'utils/utils.jsx';
import {Constants, ErrorPageTypes} from 'utils/constants.jsx';
function getPrefix() {
- if (global.window.mm_current_user_id) {
- return global.window.mm_current_user_id + '_';
+ if (global.mm_user) {
+ return global.mm_user.id + '_';
}
console.warn('BrowserStore tried to operate without user present'); //eslint-disable-line no-console
@@ -50,6 +50,7 @@ class BrowserStoreClass {
getGlobalItem(name, defaultValue = null) {
var result = null;
+
try {
if (this.isLocalStorageSupported()) {
result = JSON.parse(localStorage.getItem(name));
@@ -60,7 +61,7 @@ class BrowserStoreClass {
result = null;
}
- if (!result) {
+ if (typeof result === 'undefined' || result === null) {
result = defaultValue;
}