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.
Этот коммит содержится в:
atp
2017-08-29 20:17:32 +05:30
коммит произвёл Harrison Healey
родитель 257edc9ea3
Коммит 6a312b2ad4
2 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@@ -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;
}