diff options
author | VeraLyu <lvroyce0210@gmail.com> | 2017-04-27 22:58:38 +0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-04-27 07:58:38 -0700 |
commit | fb3cc12f56a96c1772f3c31c380aa5038a158192 (patch) | |
tree | d21ffe91b945791ad77da75bde0d52fa616ea1ea | |
parent | ad701900ef8a7a53bc91732195086ca6042fd614 (diff) | |
download | chat-fb3cc12f56a96c1772f3c31c380aa5038a158192.tar.gz chat-fb3cc12f56a96c1772f3c31c380aa5038a158192.tar.bz2 chat-fb3cc12f56a96c1772f3c31c380aa5038a158192.zip |
PLT-6249: Erase custom emoji in "recently used" after deleted (#6242)
-rw-r--r-- | webapp/stores/emoji_store.jsx | 12 |
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: |