From f6c183e749820567a309adca9584f23a6ea221aa Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Mon, 29 Aug 2016 16:03:11 +0100 Subject: PLT-3980 sort custom emoji alphabetically by id. (#3893) This sorts the emoji based on their id in the custom emoji list. --- webapp/stores/emoji_store.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/stores/emoji_store.jsx b/webapp/stores/emoji_store.jsx index 076e671dd..fd72b4636 100644 --- a/webapp/stores/emoji_store.jsx +++ b/webapp/stores/emoji_store.jsx @@ -56,6 +56,7 @@ class EmojiStore extends EventEmitter { this.addCustomEmoji(emoji); } + this.sortCustomEmojis(); this.updateEmojiMap(); } @@ -76,6 +77,10 @@ class EmojiStore extends EventEmitter { this.updateEmojiMap(); } + sortCustomEmojis() { + this.customEmojis = new Map([...this.customEmojis.entries()].sort((a, b) => a[0].localeCompare(b[0]))); + } + updateEmojiMap() { // add custom emojis to the map first so that they can't override system ones this.emojis = new Map([...this.customEmojis, ...this.systemEmojis]); -- cgit v1.2.3-1-g7c22