emoji: Convert default_emoji_aliases from object to Map.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-05 15:20:45 -08:00 committed by Tim Abbott
parent 362ab8838b
commit 44b3b7cf4a
2 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@ exports.emojis_by_name = new Map();
exports.all_realm_emojis = new Map();
exports.active_realm_emojis = new Map();
exports.default_emoji_aliases = {};
exports.default_emoji_aliases = new Map();
const zulip_emoji = {
id: 'zulip',
@ -49,10 +49,10 @@ exports.initialize = function initialize() {
_.each(emoji_codes.names, function (value) {
const base_name = emoji_codes.name_to_codepoint[value];
if (exports.default_emoji_aliases.hasOwnProperty(base_name)) {
exports.default_emoji_aliases[base_name].push(value);
if (exports.default_emoji_aliases.has(base_name)) {
exports.default_emoji_aliases.get(base_name).push(value);
} else {
exports.default_emoji_aliases[base_name] = [value];
exports.default_emoji_aliases.set(base_name, [value]);
}
});
@ -98,7 +98,7 @@ exports.build_emoji_data = function (realm_emojis) {
emoji_dict = {
name: emoji_name,
display_name: emoji_name,
aliases: exports.default_emoji_aliases[codepoint],
aliases: exports.default_emoji_aliases.get(codepoint),
is_realm_emoji: false,
emoji_code: codepoint,
has_reacted: false,

View File

@ -246,7 +246,7 @@ function get_alias_to_be_used(message_id, 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];
aliases = emoji.default_emoji_aliases.get(codepoint);
} else {
blueslip.error("Invalid emoji name.");
return;