summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorVeraLyu <lvroyce0210@gmail.com>2017-04-27 22:58:38 +0800
committerCorey Hulen <corey@hulen.com>2017-04-27 07:58:38 -0700
commitfb3cc12f56a96c1772f3c31c380aa5038a158192 (patch)
treed21ffe91b945791ad77da75bde0d52fa616ea1ea /webapp
parentad701900ef8a7a53bc91732195086ca6042fd614 (diff)
downloadchat-fb3cc12f56a96c1772f3c31c380aa5038a158192.tar.gz
chat-fb3cc12f56a96c1772f3c31c380aa5038a158192.tar.bz2
chat-fb3cc12f56a96c1772f3c31c380aa5038a158192.zip
PLT-6249: Erase custom emoji in "recently used" after deleted (#6242)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/stores/emoji_store.jsx12
1 files changed, 12 insertions, 0 deletions
diff --git a/webapp/stores/emoji_store.jsx b/webapp/stores/emoji_store.jsx
index ff9ec64f8..8a4165dd4 100644
--- a/webapp/stores/emoji_store.jsx
+++ b/webapp/stores/emoji_store.jsx
@@ -139,6 +139,17 @@ class EmojiStore extends EventEmitter {
return this.map.get(name);
}
+ removeRecentEmoji(id) {
+ const recentEmojis = this.getRecentEmojis();
+ for (let i = recentEmojis.length - 1; i >= 0; i--) {
+ if (recentEmojis[i].id === id) {
+ recentEmojis.splice(i, 1);
+ break;
+ }
+ }
+ localStorage.setItem(Constants.RECENT_EMOJI_KEY, JSON.stringify(recentEmojis));
+ }
+
addRecentEmoji(rawAlias) {
const recentEmojis = this.getRecentEmojis();
@@ -214,6 +225,7 @@ class EmojiStore extends EventEmitter {
break;
case ActionTypes.REMOVED_CUSTOM_EMOJI:
this.removeCustomEmoji(action.id);
+ this.removeRecentEmoji(action.id);
this.emitChange();
break;
case ActionTypes.EMOJI_POSTED: