mirror of https://github.com/zulip/zulip.git
emoji: Convert all_realm_emojis from object to Map.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
ab93385106
commit
419666fc31
|
@ -5,7 +5,7 @@ zrequire('people');
|
|||
zrequire('reactions');
|
||||
|
||||
set_global('emoji', {
|
||||
all_realm_emojis: {
|
||||
all_realm_emojis: new Map(Object.entries({
|
||||
991: {
|
||||
id: '991',
|
||||
emoji_name: 'realm_emoji',
|
||||
|
@ -24,7 +24,7 @@ set_global('emoji', {
|
|||
emoji_url: 'TBD',
|
||||
deactivated: false,
|
||||
},
|
||||
},
|
||||
})),
|
||||
active_realm_emojis: {
|
||||
realm_emoji: {
|
||||
id: '991',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// emojis. Emoji picker uses this data to derive data for its own use.
|
||||
exports.emojis_by_name = new Map();
|
||||
|
||||
exports.all_realm_emojis = {};
|
||||
exports.all_realm_emojis = new Map();
|
||||
exports.active_realm_emojis = {};
|
||||
exports.default_emoji_aliases = {};
|
||||
|
||||
|
@ -19,14 +19,16 @@ exports.update_emojis = function update_emojis(realm_emojis) {
|
|||
// exports.all_realm_emojis is emptied before adding the realm-specific emoji
|
||||
// to it. This makes sure that in case of deletion, the deleted realm_emojis
|
||||
// don't persist in exports.active_realm_emojis.
|
||||
exports.all_realm_emojis = {};
|
||||
exports.all_realm_emojis.clear();
|
||||
exports.active_realm_emojis = {};
|
||||
|
||||
_.each(realm_emojis, function (data) {
|
||||
exports.all_realm_emojis[data.id] = {id: data.id,
|
||||
emoji_name: data.name,
|
||||
emoji_url: data.source_url,
|
||||
deactivated: data.deactivated};
|
||||
exports.all_realm_emojis.set(data.id, {
|
||||
id: data.id,
|
||||
emoji_name: data.name,
|
||||
emoji_url: data.source_url,
|
||||
deactivated: data.deactivated,
|
||||
});
|
||||
if (data.deactivated !== true) {
|
||||
exports.active_realm_emojis[data.name] = {id: data.id,
|
||||
emoji_name: data.name,
|
||||
|
|
|
@ -286,7 +286,7 @@ exports.view.insert_new_reaction = function (opts) {
|
|||
|
||||
if (opts.reaction_type !== 'unicode_emoji') {
|
||||
context.is_realm_emoji = true;
|
||||
context.url = emoji.all_realm_emojis[emoji_code].emoji_url;
|
||||
context.url = emoji.all_realm_emojis.get(emoji_code).emoji_url;
|
||||
}
|
||||
|
||||
context.count = 1;
|
||||
|
@ -428,7 +428,7 @@ exports.get_message_reactions = function (message) {
|
|||
|
||||
if (reaction.reaction_type !== 'unicode_emoji') {
|
||||
reaction.is_realm_emoji = true;
|
||||
reaction.url = emoji.all_realm_emojis[reaction.emoji_code].emoji_url;
|
||||
reaction.url = emoji.all_realm_emojis.get(reaction.emoji_code).emoji_url;
|
||||
}
|
||||
if (reaction.user_ids.indexOf(page_params.user_id) !== -1) {
|
||||
reaction.class = "message_reaction reacted";
|
||||
|
|
Loading…
Reference in New Issue