From 86dfb35ff3f7925dbf5cf5925840b6ef4943aa0c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 10 Feb 2021 08:06:24 -0800 Subject: [PATCH] js: Convert static/js/settings_muting.js to ES6 module. Signed-off-by: Anders Kaseorg --- .eslintrc.json | 1 - static/js/bundles/app.js | 1 - static/js/global.d.ts | 1 - static/js/muting_ui.js | 1 + static/js/settings_muting.js | 18 +++++++----------- static/js/settings_sections.js | 2 ++ 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index db913f8ec6..0eb462688e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -241,7 +241,6 @@ "settings_exports": false, "settings_linkifiers": false, "settings_invites": false, - "settings_muting": false, "settings_notifications": false, "settings_org": false, "settings_panel_menu": false, diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index e857c3c54d..e39f8229d6 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -132,7 +132,6 @@ import "../settings_account"; import "../settings_display"; import "../settings_notifications"; import "../settings_bots"; -import "../settings_muting"; import "../settings_sections"; import "../settings_emoji"; import "../settings_exports"; diff --git a/static/js/global.d.ts b/static/js/global.d.ts index d0c0d6fe01..bc756c3efe 100644 --- a/static/js/global.d.ts +++ b/static/js/global.d.ts @@ -109,7 +109,6 @@ declare let settings_emoji: any; declare let settings_exports: any; declare let settings_invites: any; declare let settings_linkifiers: any; -declare let settings_muting: any; declare let settings_notifications: any; declare let settings_org: any; declare let settings_panel_menu: any; diff --git a/static/js/muting_ui.js b/static/js/muting_ui.js index ccfc9c088c..847398e9de 100644 --- a/static/js/muting_ui.js +++ b/static/js/muting_ui.js @@ -4,6 +4,7 @@ const render_muted_topic_ui_row = require("../templates/muted_topic_ui_row.hbs") const render_topic_muted = require("../templates/topic_muted.hbs"); const feedback_widget = require("./feedback_widget"); +const settings_muting = require("./settings_muting"); function timestamp_ms() { return Date.now(); diff --git a/static/js/settings_muting.js b/static/js/settings_muting.js index 06e73c227d..6b882fefb4 100644 --- a/static/js/settings_muting.js +++ b/static/js/settings_muting.js @@ -1,9 +1,7 @@ -"use strict"; +export let loaded = false; -exports.loaded = false; - -exports.set_up = function () { - exports.loaded = true; +export function set_up() { + loaded = true; $("body").on("click", ".settings-unmute-topic", function (e) { const $row = $(this).closest("tr"); const stream_id = Number.parseInt($row.attr("data-stream-id"), 10); @@ -16,10 +14,8 @@ exports.set_up = function () { }); muting_ui.set_up_muted_topics_ui(); -}; +} -exports.reset = function () { - exports.loaded = false; -}; - -window.settings_muting = exports; +export function reset() { + loaded = false; +} diff --git a/static/js/settings_sections.js b/static/js/settings_sections.js index 6d018fbc51..7a190c9315 100644 --- a/static/js/settings_sections.js +++ b/static/js/settings_sections.js @@ -1,5 +1,7 @@ "use strict"; +const settings_muting = require("./settings_muting"); + const load_func_dict = new Map(); // group -> function const loaded_groups = new Set();