diff --git a/.eslintrc.json b/.eslintrc.json index e46c1718c7..382f80ca40 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -153,7 +153,6 @@ "panels": false, "pointer": false, "reactions": false, - "realm_logo": false, "realm_night_logo": false, "recent_topics": false, "reminder": false, diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index 189575511b..a41dddd18d 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -49,7 +49,8 @@ rewiremock("../../static/js/notifications").with(notifications); const reactions = set_global("reactions", {}); const realm_icon = {__esModule: true}; rewiremock("../../static/js/realm_icon").with(realm_icon); -const realm_logo = set_global("realm_logo", {}); +const realm_logo = {__esModule: true}; +rewiremock("../../static/js/realm_logo").with(realm_logo); const reload = {__esModule: true}; rewiremock("../../static/js/reload").with(reload); const scroll_bar = {__esModule: true}; diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index 3293bc8672..0b2cd43c0f 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -71,6 +71,7 @@ const _ui_report = { }; const _realm_logo = { + __esModule: true, build_realm_logo_widget: noop, }; @@ -83,7 +84,7 @@ set_global("csrf_token", "token-stub"); set_global("FormData", _FormData); set_global("jQuery", _jQuery); rewiremock("../../static/js/loading").with(_loading); -set_global("realm_logo", _realm_logo); +rewiremock("../../static/js/realm_logo").with(_realm_logo); rewiremock("../../static/js/ui_report").with(_ui_report); rewiremock("../../static/js/list_widget").with(_ListWidget); diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index 802c797236..caa28922c4 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -34,7 +34,6 @@ import "../message_events"; import "../server_events"; import "../zulip"; import "../templates"; -import "../realm_logo"; import "../reminder"; import "../confirm_dialog"; import "../dropdown_list_widget"; diff --git a/static/js/global.d.ts b/static/js/global.d.ts index 859f507bf1..ed7eb20871 100644 --- a/static/js/global.d.ts +++ b/static/js/global.d.ts @@ -26,7 +26,6 @@ declare let page_params: any; declare let panels: any; declare let pointer: any; declare let reactions: any; -declare let realm_logo: any; declare let recent_topics: any; declare let reminder: any; declare let search_pill_widget: any; diff --git a/static/js/realm_logo.js b/static/js/realm_logo.js index b6f2eda6f1..d8d373cdce 100644 --- a/static/js/realm_logo.js +++ b/static/js/realm_logo.js @@ -1,10 +1,8 @@ -"use strict"; +import * as channel from "./channel"; +import * as settings_config from "./settings_config"; +import * as upload_widget from "./upload_widget"; -const channel = require("./channel"); -const settings_config = require("./settings_config"); -const upload_widget = require("./upload_widget"); - -exports.build_realm_logo_widget = function (upload_function, is_night) { +export function build_realm_logo_widget(upload_function, is_night) { let logo_section_id = "#realm-day-logo-upload-widget"; let logo_source = page_params.realm_logo_source; @@ -49,7 +47,7 @@ exports.build_realm_logo_widget = function (upload_function, is_night) { upload_function, page_params.max_logo_file_size, ); -}; +} function change_logo_delete_button(logo_source, logo_delete_button, file_input) { if (logo_source === "U") { @@ -62,7 +60,7 @@ function change_logo_delete_button(logo_source, logo_delete_button, file_input) } } -exports.rerender = function () { +export function rerender() { const file_input = $("#realm-day-logo-upload-widget .image_file_input"); const night_file_input = $("#realm-night-logo-upload-widget .realm-logo-file-input"); $("#realm-day-logo-upload-widget .image-block").attr("src", page_params.realm_logo_url); @@ -104,6 +102,4 @@ exports.rerender = function () { $("#realm-night-logo-upload-widget .image-delete-button"), night_file_input, ); -}; - -window.realm_logo = exports; +} diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index a383aa97a4..551bc449e4 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -18,6 +18,7 @@ import * as overlays from "./overlays"; import * as peer_data from "./peer_data"; import * as people from "./people"; import * as realm_icon from "./realm_icon"; +import * as realm_logo from "./realm_logo"; import * as reload from "./reload"; import * as scroll_bar from "./scroll_bar"; import * as settings_config from "./settings_config"; diff --git a/static/js/settings_org.js b/static/js/settings_org.js index cad8b8f43a..cd2f5c1a7e 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -8,6 +8,7 @@ const channel = require("./channel"); const loading = require("./loading"); const overlays = require("./overlays"); const realm_icon = require("./realm_icon"); +const realm_logo = require("./realm_logo"); const settings_config = require("./settings_config"); const settings_ui = require("./settings_ui"); const stream_data = require("./stream_data");