diff options
Diffstat (limited to 'webapp/stores/emoji_store.jsx')
-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: |