Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

js: Convert static/js/settings_muting.js to ES6 module.

Anders Kaseorg86dfb35ff3f7
diff --git a/.eslintrc.json b/.eslintrc.json
index db913f8ec60..0eb462688e4 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 e857c3c54d2..e39f8229d62 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 d0c0d6fe01d..bc756c3efe0 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 ccfc9c088c9..847398e9de3 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 06e73c227d0..6b882fefb4a 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 6d018fbc512..7a190c9315c 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();