PLT-3631 Properly update PostViewController when emojis change (#3565)

* Properly remove custom emojis from clientside store

* Properly update PostViewController when emojis change
Этот коммит содержится в:
Harrison Healey
2016-07-12 16:06:03 -04:00
коммит произвёл GitHub
родитель 34ec30e806
Коммит caef414abe
2 изменённых файлов: 14 добавлений и 2 удалений

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

@@ -247,6 +247,10 @@ export default class PostViewController extends React.Component {
return true; return true;
} }
if (nextState.emojis !== this.state.emojis) {
return true;
}
return false; return false;
} }

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

@@ -54,12 +54,13 @@ class EmojiStore extends EventEmitter {
this.addCustomEmoji(emoji); this.addCustomEmoji(emoji);
} }
// add custom emojis to the map first so that they can't override system ones this.updateEmojiMap();
this.emojis = new Map([...this.customEmojis, ...this.systemEmojis]);
} }
addCustomEmoji(emoji) { addCustomEmoji(emoji) {
this.customEmojis.set(emoji.name, emoji); this.customEmojis.set(emoji.name, emoji);
// this doesn't update this.emojis, but it's only called by setCustomEmojis which does that afterwards
} }
removeCustomEmoji(id) { removeCustomEmoji(id) {
@@ -69,6 +70,13 @@ class EmojiStore extends EventEmitter {
break; break;
} }
} }
this.updateEmojiMap();
}
updateEmojiMap() {
// add custom emojis to the map first so that they can't override system ones
this.emojis = new Map([...this.customEmojis, ...this.systemEmojis]);
} }
getSystemEmojis() { getSystemEmojis() {