emoji: Convert active_realm_emojis from object to Map.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-02-05 15:17:30 -08:00
committed by Tim Abbott
parent 419666fc31
commit 362ab8838b
9 changed files with 29 additions and 27 deletions

View File

@@ -102,9 +102,9 @@ function show_emoji_catalog() {
exports.generate_emoji_picker_data = function (realm_emojis) {
exports.complete_emoji_catalog = {};
exports.complete_emoji_catalog.Custom = [];
_.each(realm_emojis, function (realm_emoji, realm_emoji_name) {
for (const realm_emoji_name of realm_emojis.keys()) {
exports.complete_emoji_catalog.Custom.push(emoji.emojis_by_name.get(realm_emoji_name));
});
}
_.each(emoji_codes.emoji_catalog, function (codepoints, category) {
exports.complete_emoji_catalog[category] = [];
@@ -243,7 +243,7 @@ function get_alias_to_be_used(message_id, emoji_name) {
// the passed name as it is.
const message = message_store.get(message_id);
let aliases = [emoji_name];
if (!emoji.active_realm_emojis.hasOwnProperty(emoji_name)) {
if (!emoji.active_realm_emojis.has(emoji_name)) {
if (emoji_codes.name_to_codepoint.hasOwnProperty(emoji_name)) {
const codepoint = emoji_codes.name_to_codepoint[emoji_name];
aliases = emoji.default_emoji_aliases[codepoint];