mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixing warning with drafts.
This commit is contained in:
@@ -8,7 +8,7 @@ function getPrefix() {
|
||||
return global.window.mm_current_user_id + '_';
|
||||
}
|
||||
|
||||
console.log('BrowserStore tried to operate without user present'); //eslint-disable-line no-console
|
||||
console.warn('BrowserStore tried to operate without user present'); //eslint-disable-line no-console
|
||||
|
||||
return 'unknown_';
|
||||
}
|
||||
@@ -144,18 +144,14 @@ class BrowserStoreClass {
|
||||
* Signature for action is action(key, value)
|
||||
*/
|
||||
actionOnGlobalItemsWithPrefix(prefix, action) {
|
||||
var globalPrefix = getPrefix();
|
||||
var globalPrefixiLen = globalPrefix.length;
|
||||
|
||||
var storage = sessionStorage;
|
||||
if (this.isLocalStorageSupported()) {
|
||||
storage = localStorage;
|
||||
}
|
||||
|
||||
for (var key in storage) {
|
||||
if (key.lastIndexOf(globalPrefix + prefix, 0) === 0) {
|
||||
var userkey = key.substring(globalPrefixiLen);
|
||||
action(userkey, this.getGlobalItem(key));
|
||||
if (key.lastIndexOf(prefix, 0) === 0) {
|
||||
action(key, this.getGlobalItem(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ class PostStoreClass extends EventEmitter {
|
||||
BrowserStore.actionOnGlobalItemsWithPrefix('draft_', (key, value) => {
|
||||
if (value) {
|
||||
value.uploadsInProgress = [];
|
||||
BrowserStore.setItem(key, value);
|
||||
BrowserStore.setGlobalItem(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -503,7 +503,7 @@ class PostStoreClass extends EventEmitter {
|
||||
BrowserStore.actionOnGlobalItemsWithPrefix('comment_draft_', (key, value) => {
|
||||
if (value) {
|
||||
value.uploadsInProgress = [];
|
||||
BrowserStore.setItem(key, value);
|
||||
BrowserStore.setGlobalItem(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user