Save recently used emojis after logout (#5926)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
1bcb5cdb9d
Коммит
169c490892
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import {browserHistory} from 'react-router/es6';
|
import {browserHistory} from 'react-router/es6';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
const notSupportedParams = {
|
const notSupportedParams = {
|
||||||
title: Utils.localizeMessage('error.not_supported.title', 'Browser not supported'),
|
title: Utils.localizeMessage('error.not_supported.title', 'Browser not supported'),
|
||||||
@@ -151,10 +152,15 @@ class BrowserStoreClass {
|
|||||||
const serverVersion = this.getLastServerVersion();
|
const serverVersion = this.getLastServerVersion();
|
||||||
const landingPageSeen = this.hasSeenLandingPage();
|
const landingPageSeen = this.hasSeenLandingPage();
|
||||||
const selectedTeams = this.getItem('selected_teams');
|
const selectedTeams = this.getItem('selected_teams');
|
||||||
|
const recentEmojis = localStorage.getItem(Constants.RECENT_EMOJI_KEY);
|
||||||
|
|
||||||
sessionStorage.clear();
|
sessionStorage.clear();
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
|
||||||
|
if (recentEmojis) {
|
||||||
|
localStorage.setItem(Constants.RECENT_EMOJI_KEY, recentEmojis);
|
||||||
|
}
|
||||||
|
|
||||||
if (logoutId) {
|
if (logoutId) {
|
||||||
sessionStorage.setItem('__logout__', logoutId);
|
sessionStorage.setItem('__logout__', logoutId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import * as Emoji from 'utils/emoji.jsx';
|
|||||||
const ActionTypes = Constants.ActionTypes;
|
const ActionTypes = Constants.ActionTypes;
|
||||||
|
|
||||||
const CHANGE_EVENT = 'changed';
|
const CHANGE_EVENT = 'changed';
|
||||||
const RECENT_EMOJI_KEY = 'recentEmojis';
|
|
||||||
const MAXIMUM_RECENT_EMOJI = 27;
|
const MAXIMUM_RECENT_EMOJI = 27;
|
||||||
|
|
||||||
// Wrap the contents of the store so that we don't need to construct an ES6 map where most of the content
|
// Wrap the contents of the store so that we don't need to construct an ES6 map where most of the content
|
||||||
@@ -171,11 +170,11 @@ class EmojiStore extends EventEmitter {
|
|||||||
if (recentEmojis.length > MAXIMUM_RECENT_EMOJI) {
|
if (recentEmojis.length > MAXIMUM_RECENT_EMOJI) {
|
||||||
recentEmojis.splice(0, recentEmojis.length - MAXIMUM_RECENT_EMOJI);
|
recentEmojis.splice(0, recentEmojis.length - MAXIMUM_RECENT_EMOJI);
|
||||||
}
|
}
|
||||||
localStorage.setItem(RECENT_EMOJI_KEY, JSON.stringify(recentEmojis));
|
localStorage.setItem(Constants.RECENT_EMOJI_KEY, JSON.stringify(recentEmojis));
|
||||||
}
|
}
|
||||||
|
|
||||||
getRecentEmojis() {
|
getRecentEmojis() {
|
||||||
const result = JSON.parse(localStorage.getItem(RECENT_EMOJI_KEY));
|
const result = JSON.parse(localStorage.getItem(Constants.RECENT_EMOJI_KEY));
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -903,6 +903,7 @@ export const Constants = {
|
|||||||
MIN_HASHTAG_LINK_LENGTH: 3,
|
MIN_HASHTAG_LINK_LENGTH: 3,
|
||||||
CHANNEL_SCROLL_ADJUSTMENT: 100,
|
CHANNEL_SCROLL_ADJUSTMENT: 100,
|
||||||
EMOJI_PATH: '/static/emoji',
|
EMOJI_PATH: '/static/emoji',
|
||||||
|
RECENT_EMOJI_KEY: 'recentEmojis',
|
||||||
DEFAULT_WEBHOOK_LOGO: logoWebhook,
|
DEFAULT_WEBHOOK_LOGO: logoWebhook,
|
||||||
MHPNS: 'https://push.mattermost.com',
|
MHPNS: 'https://push.mattermost.com',
|
||||||
MTPNS: 'http://push-test.mattermost.com',
|
MTPNS: 'http://push-test.mattermost.com',
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user