From d11c6686a1273e1e607b81788e71f311ca3e0ae4 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 23 Jul 2020 22:42:44 +0000 Subject: [PATCH] minor: Remove parameter to populate_emoji. This is an easy prep step to help out phase out page_params.realm_emoji. All callers pass in what's effectively page_params.realm_emoji. (The dispatch code does it indirectly.) --- static/js/server_events_dispatch.js | 2 +- static/js/settings_emoji.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index bbb9b3f67a..f9014ba6de 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -218,7 +218,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) { // can display it properly when reopened without refresh. page_params.realm_emoji = event.realm_emoji; emoji.update_emojis(event.realm_emoji); - settings_emoji.populate_emoji(event.realm_emoji); + settings_emoji.populate_emoji(); emoji_picker.generate_emoji_picker_data(emoji.active_realm_emojis); composebox_typeahead.update_emoji_data(); break; diff --git a/static/js/settings_emoji.js b/static/js/settings_emoji.js index 95039f2b7f..2e0d805b54 100644 --- a/static/js/settings_emoji.js +++ b/static/js/settings_emoji.js @@ -45,7 +45,7 @@ exports.update_custom_emoji_ui = function () { $(".admin-emoji-form").show(); } - exports.populate_emoji(page_params.realm_emoji); + exports.populate_emoji(); }; exports.reset = function () { @@ -61,11 +61,13 @@ function sort_author_full_name(a, b) { return -1; } -exports.populate_emoji = function (emoji_data) { +exports.populate_emoji = function () { if (!meta.loaded) { return; } + const emoji_data = page_params.realm_emoji; + for (const emoji of Object.values(emoji_data)) { // Add people.js data for the user here. if (emoji.author_id !== null) { @@ -141,7 +143,7 @@ exports.set_up = function () { loading.make_indicator($("#admin_page_emoji_loading_indicator")); // Populate emoji table - exports.populate_emoji(page_params.realm_emoji); + exports.populate_emoji(); $(".admin_emoji_table").on("click", ".delete", function (e) { e.preventDefault();