PLT-3980 sort custom emoji alphabetically by id. (#3893)

This sorts the emoji based on their id in the custom emoji list.
Этот коммит содержится в:
George Goldberg
2016-08-29 16:03:11 +01:00
коммит произвёл Joram Wilander
родитель a76db5b84f
Коммит f6c183e749

Просмотреть файл

@@ -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]);