Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Rename muting module to muted_topics.
Priyank Patel5f74e78beeac
diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.jsindex 193eab4aee1..d0f08020b44 100644--- a/frontend_tests/node_tests/message_list_data.js+++ b/frontend_tests/node_tests/message_list_data.js@@ -11,7 +11,7 @@ set_global("setTimeout", (f, delay) => {return f();});-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const muted_users = zrequire("muted_users");const {MessageListData} = zrequire("../js/message_list_data");const {Filter} = zrequire("filter");@@ -130,7 +130,7 @@ run_test("muting", () => {// `messages_filtered_for_topic_mutes` should skip filtering// messages if `excludes_muted_topics` is false.with_field(- muting,+ muted_topics,"is_topic_muted",() => {throw new Error(@@ -146,7 +146,7 @@ run_test("muting", () => {// If we are in a 1:1 PM narrow, `messages_filtered_for_user_mutes` should skip// filtering messages.with_field(- muting,+ muted_topics,"is_user_muted",() => {throw new Error("Messages should not be filtered for user mutes in 1:1 PM narrows.");@@ -160,7 +160,7 @@ run_test("muting", () => {// Test actual behaviour of `messages_filtered_for_*` methods.mld.excludes_muted_topics = true;mld.filter = new Filter([{operator: "stream", operand: "general"}]);- muting.add_muted_topic(1, "muted");+ muted_topics.add_muted_topic(1, "muted");const res = mld.messages_filtered_for_topic_mutes(msgs);assert.deepEqual(res, [{id: 2, type: "stream", stream_id: 1, topic: "whatever"},diff --git a/frontend_tests/node_tests/muting.js b/frontend_tests/node_tests/muting.jsindex 7cf025846b4..54a7cffe0ae 100644--- a/frontend_tests/node_tests/muting.js+++ b/frontend_tests/node_tests/muting.js@@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test");const blueslip = require("../zjsunit/zblueslip");const {page_params} = require("../zjsunit/zpage_params");-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const muted_users = zrequire("muted_users");const stream_data = zrequire("stream_data");@@ -43,7 +43,7 @@ stream_data.add_sub(social);function test(label, f) {run_test(label, ({override}) => {- muting.set_muted_topics([]);+ muted_topics.set_muted_topics([]);muted_users.set_muted_users([]);f({override});});@@ -51,31 +51,31 @@ function test(label, f) {test("edge_cases", () => {// private messages- assert.ok(!muting.is_topic_muted(undefined, undefined));+ assert.ok(!muted_topics.is_topic_muted(undefined, undefined));// invalid userassert.ok(!muted_users.is_user_muted(undefined));});test("add_and_remove_mutes", () => {- assert.ok(!muting.is_topic_muted(devel.stream_id, "java"));- muting.add_muted_topic(devel.stream_id, "java");- assert.ok(muting.is_topic_muted(devel.stream_id, "java"));+ assert.ok(!muted_topics.is_topic_muted(devel.stream_id, "java"));+ muted_topics.add_muted_topic(devel.stream_id, "java");+ assert.ok(muted_topics.is_topic_muted(devel.stream_id, "java"));// test idempotentcy- muting.add_muted_topic(devel.stream_id, "java");- assert.ok(muting.is_topic_muted(devel.stream_id, "java"));+ muted_topics.add_muted_topic(devel.stream_id, "java");+ assert.ok(muted_topics.is_topic_muted(devel.stream_id, "java"));- muting.remove_muted_topic(devel.stream_id, "java");- assert.ok(!muting.is_topic_muted(devel.stream_id, "java"));+ muted_topics.remove_muted_topic(devel.stream_id, "java");+ assert.ok(!muted_topics.is_topic_muted(devel.stream_id, "java"));// test idempotentcy- muting.remove_muted_topic(devel.stream_id, "java");- assert.ok(!muting.is_topic_muted(devel.stream_id, "java"));+ muted_topics.remove_muted_topic(devel.stream_id, "java");+ assert.ok(!muted_topics.is_topic_muted(devel.stream_id, "java"));// test unknown stream is harmless too- muting.remove_muted_topic(unknown.stream_id, "java");- assert.ok(!muting.is_topic_muted(unknown.stream_id, "java"));+ muted_topics.remove_muted_topic(unknown.stream_id, "java");+ assert.ok(!muted_topics.is_topic_muted(unknown.stream_id, "java"));assert.ok(!muted_users.is_user_muted(1));muted_users.add_muted_user(1);@@ -118,10 +118,12 @@ test("get_unmuted_users", () => {});test("get_mutes", () => {- assert.deepEqual(muting.get_muted_topics(), []);- muting.add_muted_topic(office.stream_id, "gossip", 1577836800);- muting.add_muted_topic(devel.stream_id, "java", 1577836700);- const all_muted_topics = muting.get_muted_topics().sort((a, b) => a.date_muted - b.date_muted);+ assert.deepEqual(muted_topics.get_muted_topics(), []);+ muted_topics.add_muted_topic(office.stream_id, "gossip", 1577836800);+ muted_topics.add_muted_topic(devel.stream_id, "java", 1577836700);+ const all_muted_topics = muted_topics+ .get_muted_topics()+ .sort((a, b) => a.date_muted - b.date_muted);assert.deepEqual(all_muted_topics, [{@@ -143,7 +145,10 @@ test("get_mutes", () => {assert.deepEqual(muted_users.get_muted_users(), []);muted_users.add_muted_user(6, 1577836800);muted_users.add_muted_user(4, 1577836800);- const all_muted_users = muted_users.get_muted_users().sort((a, b) => a.date_muted - b.date_muted);+ const all_muted_users = muted_users+ .get_muted_users()+ .sort((a, b) => a.date_muted - b.date_muted);+assert.deepEqual(all_muted_users, [{date_muted: 1577836800000,@@ -170,10 +175,10 @@ test("unknown streams", () => {{id: 3, timestamp: 1577836800},{id: 2, timestamp: 1577836800},];- muting.initialize();+ muted_topics.initialize();muted_users.initialize();- assert.deepEqual(muting.get_muted_topics().sort(), [+ assert.deepEqual(muted_topics.get_muted_topics().sort(), [{date_muted: 1577836800000,date_muted_str: "Jan\u00A001,\u00A02020",@@ -205,9 +210,9 @@ test("unknown streams", () => {});test("case_insensitivity", () => {- muting.set_muted_topics([]);- assert.ok(!muting.is_topic_muted(social.stream_id, "breakfast"));- muting.set_muted_topics([["SOCial", "breakfast"]]);- assert.ok(muting.is_topic_muted(social.stream_id, "breakfast"));- assert.ok(muting.is_topic_muted(social.stream_id, "breakFAST"));+ muted_topics.set_muted_topics([]);+ assert.ok(!muted_topics.is_topic_muted(social.stream_id, "breakfast"));+ muted_topics.set_muted_topics([["SOCial", "breakfast"]]);+ assert.ok(muted_topics.is_topic_muted(social.stream_id, "breakfast"));+ assert.ok(muted_topics.is_topic_muted(social.stream_id, "breakFAST"));});diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.jsindex ce262d10bee..3c2eb9cbc85 100644--- a/frontend_tests/node_tests/narrow_activate.js+++ b/frontend_tests/node_tests/narrow_activate.js@@ -48,7 +48,7 @@ set_global("setTimeout", (f, t) => {f();});-mock_esm("../../static/js/muting", {+mock_esm("../../static/js/muted_topics", {is_topic_muted: () => false,});diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.jsindex af8a476060e..03f4e63e84e 100644--- a/frontend_tests/node_tests/narrow_unread.js+++ b/frontend_tests/node_tests/narrow_unread.js@@ -6,7 +6,7 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");const blueslip = require("../zjsunit/zblueslip");-mock_esm("../../static/js/muting", {+mock_esm("../../static/js/muted_topics", {is_topic_muted: () => false,});diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.jsindex a5e1f05e415..6378b01a6c9 100644--- a/frontend_tests/node_tests/notifications.js+++ b/frontend_tests/node_tests/notifications.js@@ -18,7 +18,7 @@ const _navigator = {};set_global("navigator", _navigator);-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const stream_data = zrequire("stream_data");const ui = zrequire("ui");const spoilers = zrequire("spoilers");@@ -47,7 +47,7 @@ const muted = {stream_data.add_sub(general);stream_data.add_sub(muted);-muting.add_muted_topic(general.stream_id, "muted topic");+muted_topics.add_muted_topic(general.stream_id, "muted topic");function test(label, f) {run_test(label, ({override}) => {diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.jsindex 10fbaf511f7..23317eacbfe 100644--- a/frontend_tests/node_tests/pm_conversations.js+++ b/frontend_tests/node_tests/pm_conversations.js@@ -5,7 +5,7 @@ const {strict: assert} = require("assert");const {zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const muted_users = zrequire("muted_users");const people = zrequire("people");const pmc = zrequire("pm_conversations");@@ -23,7 +23,7 @@ const params = {function test(label, f) {run_test(label, ({override}) => {pmc.clear_for_testing();- muting.set_muted_topics([]);+ muted_topics.set_muted_topics([]);muted_users.set_muted_users([]);people.initialize_current_user(15);f({override});diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.jsindex b543c4a4afe..7a6492960c3 100644--- a/frontend_tests/node_tests/recent_topics.js+++ b/frontend_tests/node_tests/recent_topics.js@@ -89,7 +89,7 @@ mock_esm("../../static/js/message_store", {mock_esm("../../static/js/message_view_header", {render_title_area: noop,});-mock_esm("../../static/js/muting", {+mock_esm("../../static/js/muted_topics", {is_topic_muted: (stream_id, topic) => {if (stream_id === stream1 && topic === topic7) {return true;diff --git a/frontend_tests/node_tests/settings_muted_topics.js b/frontend_tests/node_tests/settings_muted_topics.jsindex b1ad66194cb..0c5498d4655 100644--- a/frontend_tests/node_tests/settings_muted_topics.js+++ b/frontend_tests/node_tests/settings_muted_topics.js@@ -10,7 +10,7 @@ const muting_ui = mock_esm("../../static/js/muting_ui");const settings_muted_topics = zrequire("settings_muted_topics");const stream_data = zrequire("stream_data");-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const noop = () => {};@@ -21,10 +21,10 @@ const frontend = {stream_data.add_sub(frontend);run_test("settings", ({override}) => {- muting.add_muted_topic(frontend.stream_id, "js", 1577836800);+ muted_topics.add_muted_topic(frontend.stream_id, "js", 1577836800);let populate_list_called = false;override(settings_muted_topics, "populate_list", () => {- const opts = muting.get_muted_topics();+ const opts = muted_topics.get_muted_topics();assert.deepEqual(opts, [{date_muted: 1577836800000,diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.jsindex 891d892d8b6..56391386a02 100644--- a/frontend_tests/node_tests/topic_generator.js+++ b/frontend_tests/node_tests/topic_generator.js@@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test");const pm_conversations = zrequire("pm_conversations");pm_conversations.recent = {};-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const unread = zrequire("unread");const stream_data = zrequire("stream_data");const stream_topic_history = zrequire("stream_topic_history");@@ -104,7 +104,7 @@ run_test("topics", ({override}) => {[devel_stream_id, muted_stream_id].includes(stream_id),);- override(muting, "is_topic_muted", (stream_name, topic) => topic === "muted");+ override(muted_topics, "is_topic_muted", (stream_name, topic) => topic === "muted");let next_item = tg.get_next_topic("announce", "whatever");assert.deepEqual(next_item, {diff --git a/frontend_tests/node_tests/topic_list_data.js b/frontend_tests/node_tests/topic_list_data.jsindex 554c7854da7..5554b6a87f6 100644--- a/frontend_tests/node_tests/topic_list_data.js+++ b/frontend_tests/node_tests/topic_list_data.js@@ -7,7 +7,7 @@ const _ = require("lodash");const {mock_esm, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");-const muting = mock_esm("../../static/js/muting", {+const muted_topics = mock_esm("../../static/js/muted_topics", {is_topic_muted() {return false;},@@ -153,7 +153,7 @@ test("get_list_info unreads", ({override}) => {unread_cnt.set("topic 5", 5);unread_cnt.set("topic 13", 13);- override(muting, "is_topic_muted", (stream_id, topic_name) => {+ override(muted_topics, "is_topic_muted", (stream_id, topic_name) => {assert.equal(stream_id, general.stream_id);return topic_name === "topic 4";});diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.jsindex 55c6a93cfed..589ce061425 100644--- a/frontend_tests/node_tests/unread.js+++ b/frontend_tests/node_tests/unread.js@@ -12,7 +12,7 @@ page_params.realm_push_notifications_enabled = false;const {FoldDict} = zrequire("fold_dict");const message_store = zrequire("message_store");-const muting = zrequire("muting");+const muted_topics = zrequire("muted_topics");const people = zrequire("people");const stream_data = zrequire("stream_data");const sub_store = zrequire("sub_store");@@ -57,7 +57,7 @@ function test_notifiable_count(home_unread_messages, expected_notifiable_count)function test(label, f) {run_test(label, ({override}) => {unread.declare_bankruptcy();- muting.set_muted_topics([]);+ muted_topics.set_muted_topics([]);f({override});});}@@ -228,7 +228,7 @@ test("muting", () => {assert.deepEqual(unread.get_msg_ids_for_stream(stream_id), [message.id]);test_notifiable_count(counts.home_unread_messages, 0);- muting.add_muted_topic(social.stream_id, "test_muting");+ muted_topics.add_muted_topic(social.stream_id, "test_muting");counts = unread.get_counts();assert.equal(counts.stream_count.get(stream_id), 0);assert.equal(counts.home_unread_messages, 0);@@ -467,7 +467,7 @@ test("mentions", () => {const muted_stream_id = 401;- muting.add_muted_topic(401, "lunch");+ muted_topics.add_muted_topic(401, "lunch");const already_read_message = {id: 14,diff --git a/static/js/message_list_data.js b/static/js/message_list_data.jsindex 8442d8210e9..865ab413d08 100644--- a/static/js/message_list_data.js+++ b/static/js/message_list_data.js@@ -3,8 +3,8 @@ import _ from "lodash";import * as blueslip from "./blueslip";import {FetchStatus} from "./fetch_status";import {Filter} from "./filter";+import * as muted_topics from "./muted_topics";import * as muted_users from "./muted_users";-import * as muting from "./muting";import {page_params} from "./page_params";import * as unread from "./unread";import * as util from "./util";@@ -174,7 +174,9 @@ export class MessageListData {if (message.type !== "stream") {return true;}- return !muting.is_topic_muted(message.stream_id, message.topic) || message.mentioned;+ return (+ !muted_topics.is_topic_muted(message.stream_id, message.topic) || message.mentioned+ );});}diff --git a/static/js/message_list_view.js b/static/js/message_list_view.jsindex 71a1ceee44a..4e322f91927 100644--- a/static/js/message_list_view.js+++ b/static/js/message_list_view.js@@ -19,8 +19,8 @@ import * as message_edit from "./message_edit";import * as message_lists from "./message_lists";import * as message_store from "./message_store";import * as message_viewport from "./message_viewport";+import * as muted_topics from "./muted_topics";import * as muted_users from "./muted_users";-import * as muting from "./muting";import * as narrow_state from "./narrow_state";import {page_params} from "./page_params";import * as people from "./people";@@ -160,7 +160,7 @@ function populate_group_from_message_container(group, message_container) {} else {group.stream_id = sub.stream_id;}- group.topic_muted = muting.is_topic_muted(group.stream_id, group.topic);+ group.topic_muted = muted_topics.is_topic_muted(group.stream_id, group.topic);} else if (group.is_private) {group.pm_with_url = message_container.pm_with_url;group.display_reply_to = message_store.get_pm_full_names(message_container.msg);diff --git a/static/js/muting.js b/static/js/muted_topics.jssimilarity index 100%rename from static/js/muting.jsrename to static/js/muted_topics.jsdiff --git a/static/js/muting_ui.js b/static/js/muting_ui.jsindex f7276eac6e3..3129293a7ae 100644--- a/static/js/muting_ui.js+++ b/static/js/muting_ui.js@@ -10,8 +10,8 @@ import * as confirm_dialog from "./confirm_dialog";import * as feedback_widget from "./feedback_widget";import {$t} from "./i18n";import * as message_lists from "./message_lists";+import * as muted_topics from "./muted_topics";import * as muted_users from "./muted_users";-import * as muting from "./muting";import * as overlays from "./overlays";import * as people from "./people";import * as pm_list from "./pm_list";@@ -37,7 +37,7 @@ export function rerender_for_muted_topic(old_muted_topics) {// We only update those topics which could have been affected, because// we want to avoid doing a complete rerender of the recent topics view,// because that can be expensive.- const current_muted_topics = muting.get_muted_topics();+ const current_muted_topics = muted_topics.get_muted_topics();const maybe_affected_topics = _.unionWith(old_muted_topics, current_muted_topics, _.isEqual);for (const topic_data of maybe_affected_topics) {@@ -46,8 +46,8 @@ export function rerender_for_muted_topic(old_muted_topics) {}export function handle_topic_updates(muted_topics) {- const old_muted_topics = muting.get_muted_topics();- muting.set_muted_topics(muted_topics);+ const old_muted_topics = muted_topics.get_muted_topics();+ muted_topics.set_muted_topics(muted_topics);stream_popover.hide_topic_popover();unread_ui.update_unread_counts();rerender_for_muted_topic(old_muted_topics);@@ -117,7 +117,7 @@ export function toggle_topic_mute(message) {const stream_id = message.stream_id;const topic = message.topic;- if (muting.is_topic_muted(stream_id, topic)) {+ if (muted_topics.is_topic_muted(stream_id, topic)) {unmute_topic(stream_id, topic);} else if (message.type === "stream") {mute_topic(stream_id, topic, true);diff --git a/static/js/notifications.js b/static/js/notifications.jsindex f3685a4d1fc..e99b078a2c1 100644--- a/static/js/notifications.js+++ b/static/js/notifications.js@@ -10,7 +10,7 @@ import * as favicon from "./favicon";import {$t} from "./i18n";import * as message_lists from "./message_lists";import * as message_store from "./message_store";-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import * as narrow from "./narrow";import * as narrow_state from "./narrow_state";import * as navigate from "./navigate";@@ -361,7 +361,10 @@ export function message_is_notifiable(message) {return false;}- if (message.type === "stream" && muting.is_topic_muted(message.stream_id, message.topic)) {+ if (+ message.type === "stream" &&+ muted_topics.is_topic_muted(message.stream_id, message.topic)+ ) {return false;}@@ -539,7 +542,10 @@ export function get_local_notify_mix_reason(message) {return undefined;}- if (message.type === "stream" && muting.is_topic_muted(message.stream_id, message.topic)) {+ if (+ message.type === "stream" &&+ muted_topics.is_topic_muted(message.stream_id, message.topic)+ ) {return $t({defaultMessage: "Sent! Your message was sent to a topic you have muted."});}diff --git a/static/js/popovers.js b/static/js/popovers.jsindex 3f2d35f03e9..a149108a4b9 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -28,8 +28,8 @@ import * as message_edit from "./message_edit";import * as message_edit_history from "./message_edit_history";import * as message_lists from "./message_lists";import * as message_viewport from "./message_viewport";+import * as muted_topics from "./muted_topics";import * as muted_users from "./muted_users";-import * as muting from "./muting";import * as muting_ui from "./muting_ui";import * as narrow from "./narrow";import * as narrow_state from "./narrow_state";@@ -422,9 +422,9 @@ export function toggle_actions_popover(element, id) {}const topic = message.topic;const can_mute_topic =- message.stream && topic && !muting.is_topic_muted(message.stream_id, topic);+ message.stream && topic && !muted_topics.is_topic_muted(message.stream_id, topic);const can_unmute_topic =- message.stream && topic && muting.is_topic_muted(message.stream_id, topic);+ message.stream && topic && muted_topics.is_topic_muted(message.stream_id, topic);const should_display_edit_history_option =message.edit_history &&diff --git a/static/js/recent_topics_ui.js b/static/js/recent_topics_ui.jsindex f5712a0c7be..a9b7bccc0cd 100644--- a/static/js/recent_topics_ui.js+++ b/static/js/recent_topics_ui.js@@ -12,7 +12,7 @@ import {localstorage} from "./localstorage";import * as message_store from "./message_store";import * as message_util from "./message_util";import * as message_view_header from "./message_view_header";-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import * as narrow from "./narrow";import * as narrow_state from "./narrow_state";import * as navbar_alerts from "./navbar_alerts";@@ -233,7 +233,7 @@ function format_topic(topic_data) {// We only supply the data to the topic rows and let jquery// display / hide them according to filters instead of// doing complete re-render.- const topic_muted = Boolean(muting.is_topic_muted(stream_id, topic));+ const topic_muted = Boolean(muted_topics.is_topic_muted(stream_id, topic));const stream_muted = stream_data.is_muted(stream_id);const muted = topic_muted || stream_muted;const unread_count = unread.num_unread_for_topic(stream_id, topic);@@ -341,7 +341,7 @@ export function filters_should_hide_topic(topic_data) {}if (!filters.has("include_muted")) {- const topic_muted = Boolean(muting.is_topic_muted(msg.stream_id, msg.topic));+ const topic_muted = Boolean(muted_topics.is_topic_muted(msg.stream_id, msg.topic));const stream_muted = stream_data.is_muted(msg.stream_id);if (topic_muted || stream_muted) {return true;diff --git a/static/js/settings_muted_topics.js b/static/js/settings_muted_topics.jsindex 4e165c5d851..a1a94a2000c 100644--- a/static/js/settings_muted_topics.js+++ b/static/js/settings_muted_topics.js@@ -3,14 +3,14 @@ import $ from "jquery";import render_muted_topic_ui_row from "../templates/muted_topic_ui_row.hbs";import * as ListWidget from "./list_widget";-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import * as muting_ui from "./muting_ui";import * as ui from "./ui";export let loaded = false;export function populate_list() {- const all_muted_topics = muting.get_muted_topics();+ const all_muted_topics = muted_topics.get_muted_topics();const muted_topics_table = $("#muted_topics_table");const $search_input = $("#muted_topics_search");diff --git a/static/js/stream_popover.js b/static/js/stream_popover.jsindex 613a34b440b..ecdd2726eed 100644--- a/static/js/stream_popover.js+++ b/static/js/stream_popover.js@@ -17,7 +17,7 @@ import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widgetimport * as hash_util from "./hash_util";import {$t, $t_html} from "./i18n";import * as message_edit from "./message_edit";-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import * as muting_ui from "./muting_ui";import * as overlays from "./overlays";import {page_params} from "./page_params";@@ -261,7 +261,7 @@ function build_topic_popover(opts) {popovers.hide_all();show_streamlist_sidebar();- const topic_muted = muting.is_topic_muted(sub.stream_id, topic_name);+ const topic_muted = muted_topics.is_topic_muted(sub.stream_id, topic_name);const has_starred_messages = starred_messages.get_count_in_topic(sub.stream_id, topic_name) > 0;// Arguably, we could offer the "Move topic" option even if users// can only edit the name within a stream.diff --git a/static/js/topic_generator.js b/static/js/topic_generator.jsindex 35bf97ff5f7..fbfe3f39e06 100644--- a/static/js/topic_generator.js+++ b/static/js/topic_generator.js@@ -1,4 +1,4 @@-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import * as pm_conversations from "./pm_conversations";import * as stream_data from "./stream_data";import * as stream_sort from "./stream_sort";@@ -67,7 +67,7 @@ export function get_next_topic(curr_stream, curr_topic) {function get_unmuted_topics(stream_name) {const stream_id = stream_data.get_stream_id(stream_name);let topics = stream_topic_history.get_recent_topic_names(stream_id);- topics = topics.filter((topic) => !muting.is_topic_muted(stream_id, topic));+ topics = topics.filter((topic) => !muted_topics.is_topic_muted(stream_id, topic));return topics;}diff --git a/static/js/topic_list_data.js b/static/js/topic_list_data.jsindex bb835a3e39f..52300caaa48 100644--- a/static/js/topic_list_data.js+++ b/static/js/topic_list_data.js@@ -1,5 +1,5 @@import * as hash_util from "./hash_util";-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import * as narrow_state from "./narrow_state";import * as stream_topic_history from "./stream_topic_history";import * as topic_list from "./topic_list";@@ -30,7 +30,7 @@ export function get_list_info(stream_id, zoomed) {for (const [idx, topic_name] of topic_names.entries()) {const num_unread = unread.num_unread_for_topic(stream_id, topic_name);const is_active_topic = active_topic === topic_name.toLowerCase();- const is_topic_muted = muting.is_topic_muted(stream_id, topic_name);+ const is_topic_muted = muted_topics.is_topic_muted(stream_id, topic_name);if (!zoomed) {function should_show_topic(topics_selected) {diff --git a/static/js/ui_init.js b/static/js/ui_init.jsindex 91799e52bb8..0d717101789 100644--- a/static/js/ui_init.js+++ b/static/js/ui_init.js@@ -40,8 +40,8 @@ import * as message_lists from "./message_lists";import * as message_scroll from "./message_scroll";import * as message_view_header from "./message_view_header";import * as message_viewport from "./message_viewport";+import * as muted_topics from "./muted_topics";import * as muted_users from "./muted_users";-import * as muting from "./muting";import * as navbar_alerts from "./navbar_alerts";import * as navigate from "./navigate";import * as notifications from "./notifications";@@ -486,7 +486,7 @@ export function initialize_everything() {stream_edit.initialize();stream_data.initialize(stream_data_params);pm_conversations.recent.initialize(pm_conversations_params);- muting.initialize();+ muted_topics.initialize();muted_users.initialize();subs.initialize();stream_list.initialize();diff --git a/static/js/unread.js b/static/js/unread.jsindex 08a98f5ba56..a5b990ace59 100644--- a/static/js/unread.js+++ b/static/js/unread.js@@ -1,6 +1,6 @@import {FoldDict} from "./fold_dict";import * as message_store from "./message_store";-import * as muting from "./muting";+import * as muted_topics from "./muted_topics";import {page_params} from "./page_params";import * as people from "./people";import * as settings_config from "./settings_config";@@ -251,7 +251,7 @@ class UnreadTopicCounter {let stream_count = 0;for (const [topic, msgs] of per_stream_bucketer) {const topic_count = msgs.size;- if (!muting.is_topic_muted(stream_id, topic)) {+ if (!muted_topics.is_topic_muted(stream_id, topic)) {stream_count += topic_count;}}@@ -316,7 +316,7 @@ class UnreadTopicCounter {const sub = sub_store.get(stream_id);for (const [topic, msgs] of per_stream_bucketer) {- if (sub && !muting.is_topic_muted(stream_id, topic)) {+ if (sub && !muted_topics.is_topic_muted(stream_id, topic)) {stream_count += msgs.size;}}@@ -348,7 +348,7 @@ class UnreadTopicCounter {const ids = [];const sub = sub_store.get(stream_id);for (const [topic, id_set] of per_stream_bucketer) {- if (sub && !muting.is_topic_muted(stream_id, topic)) {+ if (sub && !muted_topics.is_topic_muted(stream_id, topic)) {for (const id of id_set) {ids.push(id);}@@ -451,7 +451,7 @@ export function update_message_for_mention(message) {const is_unmuted_mention =message.type === "stream" &&message.mentioned &&- !muting.is_topic_muted(message.stream_id, message.topic);+ !muted_topics.is_topic_muted(message.stream_id, message.topic);if (is_unmuted_mention || message.mentioned_me_directly) {unread_mentions_counter.add(message.id);