Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_topics: Rename muted_topics.js to user_topics.js.
Kartik Srivastava47e5ccf0861e
diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.jsindex 2d05639abb3..886776f876b 100644--- a/frontend_tests/node_tests/message_list_data.js+++ b/frontend_tests/node_tests/message_list_data.js@@ -6,7 +6,7 @@ const {zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");const blueslip = require("../zjsunit/zblueslip");-const muted_topics = zrequire("muted_topics");+const user_topics = zrequire("user_topics");const muted_users = zrequire("muted_users");const {MessageListData} = zrequire("../js/message_list_data");const {Filter} = zrequire("filter");@@ -143,7 +143,7 @@ run_test("muting", () => {{id: 9, type: "private", to_user_ids: "9", sender_id: 11}, // 1:1 PM to non-muted];- muted_topics.add_muted_topic(1, "muted");+ user_topics.add_muted_topic(1, "muted");muted_users.add_muted_user(10);// `messages_filtered_for_topic_mutes` should skip filteringdiff --git a/frontend_tests/node_tests/muting.js b/frontend_tests/node_tests/muting.jsindex e3773efbbcd..ce5164316fa 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 muted_topics = zrequire("muted_topics");+const user_topics = zrequire("user_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}) => {- muted_topics.set_muted_topics([]);+ user_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(!muted_topics.is_topic_muted(undefined, undefined));+ assert.ok(!user_topics.is_topic_muted(undefined, undefined));// invalid userassert.ok(!muted_users.is_user_muted(undefined));});test("add_and_remove_mutes", () => {- 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"));+ assert.ok(!user_topics.is_topic_muted(devel.stream_id, "java"));+ user_topics.add_muted_topic(devel.stream_id, "java");+ assert.ok(user_topics.is_topic_muted(devel.stream_id, "java"));// test idempotency- muted_topics.add_muted_topic(devel.stream_id, "java");- assert.ok(muted_topics.is_topic_muted(devel.stream_id, "java"));+ user_topics.add_muted_topic(devel.stream_id, "java");+ assert.ok(user_topics.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"));+ user_topics.remove_muted_topic(devel.stream_id, "java");+ assert.ok(!user_topics.is_topic_muted(devel.stream_id, "java"));// test idempotency- muted_topics.remove_muted_topic(devel.stream_id, "java");- assert.ok(!muted_topics.is_topic_muted(devel.stream_id, "java"));+ user_topics.remove_muted_topic(devel.stream_id, "java");+ assert.ok(!user_topics.is_topic_muted(devel.stream_id, "java"));// test unknown stream is harmless too- muted_topics.remove_muted_topic(unknown.stream_id, "java");- assert.ok(!muted_topics.is_topic_muted(unknown.stream_id, "java"));+ user_topics.remove_muted_topic(unknown.stream_id, "java");+ assert.ok(!user_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,10 @@ test("get_unmuted_users", () => {});test("get_mutes", () => {- 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+ assert.deepEqual(user_topics.get_muted_topics(), []);+ user_topics.add_muted_topic(office.stream_id, "gossip", 1577836800);+ user_topics.add_muted_topic(devel.stream_id, "java", 1577836700);+ const all_muted_topics = user_topics.get_muted_topics().sort((a, b) => a.date_muted - b.date_muted);@@ -175,10 +175,10 @@ test("unknown streams", () => {{id: 3, timestamp: 1577836800},{id: 2, timestamp: 1577836800},];- muted_topics.initialize();+ user_topics.initialize();muted_users.initialize();- assert.deepEqual(muted_topics.get_muted_topics().sort(), [+ assert.deepEqual(user_topics.get_muted_topics().sort(), [{date_muted: 1577836800000,date_muted_str: "Jan\u00A001,\u00A02020",@@ -210,9 +210,9 @@ test("unknown streams", () => {});test("case_insensitivity", () => {- 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"));+ user_topics.set_muted_topics([]);+ assert.ok(!user_topics.is_topic_muted(social.stream_id, "breakfast"));+ user_topics.set_muted_topics([["SOCial", "breakfast"]]);+ assert.ok(user_topics.is_topic_muted(social.stream_id, "breakfast"));+ assert.ok(user_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 cb351818ca9..b9058bc503c 100644--- a/frontend_tests/node_tests/narrow_activate.js+++ b/frontend_tests/node_tests/narrow_activate.js@@ -49,7 +49,7 @@ set_global("setTimeout", (f, t) => {f();});-mock_esm("../../static/js/muted_topics", {+mock_esm("../../static/js/user_topics", {is_topic_muted: () => false,});diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.jsindex 01340550b61..637a773e9d0 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/muted_topics", {+mock_esm("../../static/js/user_topics", {is_topic_muted: () => false,});diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.jsindex e3602baf4a5..b385fafb383 100644--- a/frontend_tests/node_tests/notifications.js+++ b/frontend_tests/node_tests/notifications.js@@ -19,7 +19,7 @@ const _navigator = {};set_global("navigator", _navigator);-const muted_topics = zrequire("muted_topics");+const user_topics = zrequire("user_topics");const stream_data = zrequire("stream_data");const spoilers = zrequire("spoilers");spoilers.hide_spoilers_in_notification = () => {};@@ -47,7 +47,7 @@ const muted = {stream_data.add_sub(general);stream_data.add_sub(muted);-muted_topics.add_muted_topic(general.stream_id, "muted topic");+user_topics.add_muted_topic(general.stream_id, "muted topic");function test(label, f) {run_test(label, (helpers) => {diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.jsindex 23317eacbfe..773b536715a 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 muted_topics = zrequire("muted_topics");+const user_topics = zrequire("user_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();- muted_topics.set_muted_topics([]);+ user_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 28cfb8678e7..ede004fbd1c 100644--- a/frontend_tests/node_tests/recent_topics.js+++ b/frontend_tests/node_tests/recent_topics.js@@ -93,7 +93,7 @@ mock_esm("../../static/js/message_store", {mock_esm("../../static/js/message_view_header", {render_title_area: noop,});-mock_esm("../../static/js/muted_topics", {+mock_esm("../../static/js/user_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 b8fe740a95e..529819d8fbe 100644--- a/frontend_tests/node_tests/settings_muted_topics.js+++ b/frontend_tests/node_tests/settings_muted_topics.js@@ -11,7 +11,7 @@ const muted_topics_ui = mock_esm("../../static/js/muted_topics_ui");const settings_muted_topics = zrequire("settings_muted_topics");const stream_data = zrequire("stream_data");-const muted_topics = zrequire("muted_topics");+const user_topics = zrequire("user_topics");const noop = () => {};@@ -22,7 +22,7 @@ const frontend = {stream_data.add_sub(frontend);run_test("settings", ({override}) => {- muted_topics.add_muted_topic(frontend.stream_id, "js", 1577836800);+ user_topics.add_muted_topic(frontend.stream_id, "js", 1577836800);let populate_list_called = false;override(list_widget, "create", ($container, list) => {assert.deepEqual(list, [diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.jsindex 179c9246531..4cb84567d4e 100644--- a/frontend_tests/node_tests/topic_generator.js+++ b/frontend_tests/node_tests/topic_generator.js@@ -5,7 +5,7 @@ const {strict: assert} = require("assert");const {mock_esm, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");-const muted_topics = mock_esm("../../static/js/muted_topics");+const user_topics = mock_esm("../../static/js/user_topics");const stream_data = mock_esm("../../static/js/stream_data");const stream_topic_history = mock_esm("../../static/js/stream_topic_history");const unread = mock_esm("../../static/js/unread");@@ -105,7 +105,7 @@ run_test("topics", ({override}) => {[devel_stream_id, muted_stream_id].includes(stream_id),);- override(muted_topics, "is_topic_muted", (stream_name, topic) => topic === "muted");+ override(user_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 8939aa7b1ca..409e7f95ca5 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 muted_topics = mock_esm("../../static/js/muted_topics", {+const user_topics = mock_esm("../../static/js/user_topics", {is_topic_muted() {return false;},@@ -183,7 +183,7 @@ test("get_list_info unreads", ({override}) => {add_unreads("topic 5", 5);add_unreads("topic 13", 13);- override(muted_topics, "is_topic_muted", (stream_id, topic_name) => {+ override(user_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 ab6d5839c73..6056dfae2c2 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 muted_topics = zrequire("muted_topics");+const user_topics = zrequire("user_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, (helpers) => {unread.declare_bankruptcy();- muted_topics.set_muted_topics([]);+ user_topics.set_muted_topics([]);f(helpers);});}@@ -230,7 +230,7 @@ test("muting", () => {assert.deepEqual(unread.get_msg_ids_for_stream(stream_id), [message.id]);test_notifiable_count(counts.home_unread_messages, 0);- muted_topics.add_muted_topic(social.stream_id, "test_muting");+ user_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);@@ -463,7 +463,7 @@ test("mentions", () => {const muted_stream_id = 401;- muted_topics.add_muted_topic(401, "lunch");+ user_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 049c3edc2e6..5410bbab325 100644--- a/static/js/message_list_data.js+++ b/static/js/message_list_data.js@@ -3,10 +3,10 @@ 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 {page_params} from "./page_params";import * as unread from "./unread";+import * as user_topics from "./user_topics";import * as util from "./util";export class MessageListData {@@ -175,7 +175,7 @@ export class MessageListData {return true;}return (- !muted_topics.is_topic_muted(message.stream_id, message.topic) || message.mentioned+ !user_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 00ca019ebee..c6a67b3727b 100644--- a/static/js/message_list_view.js+++ b/static/js/message_list_view.js@@ -21,7 +21,6 @@ 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 narrow_state from "./narrow_state";import {page_params} from "./page_params";@@ -35,6 +34,7 @@ import * as stream_data from "./stream_data";import * as sub_store from "./sub_store";import * as submessage from "./submessage";import * as timerender from "./timerender";+import * as user_topics from "./user_topics";import * as util from "./util";function same_day(earlier_msg, later_msg) {@@ -212,7 +212,7 @@ function populate_group_from_message_container(group, message_container) {group.stream_id = sub.stream_id;}group.topic_is_resolved = resolved_topic.is_resolved(group.topic);- group.topic_muted = muted_topics.is_topic_muted(group.stream_id, group.topic);+ group.topic_muted = user_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/muted_topics_ui.js b/static/js/muted_topics_ui.jsindex dc34c4ab677..e605c85d120 100644--- a/static/js/muted_topics_ui.js+++ b/static/js/muted_topics_ui.js@@ -6,7 +6,6 @@ import * as channel from "./channel";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 overlays from "./overlays";import * as recent_topics_ui from "./recent_topics_ui";import * as settings_muted_topics from "./settings_muted_topics";@@ -14,6 +13,7 @@ import * as stream_data from "./stream_data";import * as stream_list from "./stream_list";import * as stream_popover from "./stream_popover";import * as unread_ui from "./unread_ui";+import * as user_topics from "./user_topics";export function rerender_for_muted_topic(old_muted_topics) {stream_list.update_streams_sidebar();@@ -28,7 +28,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 = muted_topics.get_muted_topics();+ const current_muted_topics = user_topics.get_muted_topics();const maybe_affected_topics = _.unionWith(old_muted_topics, current_muted_topics, _.isEqual);for (const topic_data of maybe_affected_topics) {@@ -37,8 +37,8 @@ export function rerender_for_muted_topic(old_muted_topics) {}export function handle_topic_updates(muted_topics_list) {- const old_muted_topics = muted_topics.get_muted_topics();- muted_topics.set_muted_topics(muted_topics_list);+ const old_muted_topics = user_topics.get_muted_topics();+ user_topics.set_muted_topics(muted_topics_list);stream_popover.hide_topic_popover();unread_ui.update_unread_counts();rerender_for_muted_topic(old_muted_topics);@@ -108,7 +108,7 @@ export function toggle_topic_mute(message) {const stream_id = message.stream_id;const topic = message.topic;- if (muted_topics.is_topic_muted(stream_id, topic)) {+ if (user_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 6f3dcfe79cf..1a6f59df88a 100644--- a/static/js/notifications.js+++ b/static/js/notifications.js@@ -10,7 +10,6 @@ import * as hash_util from "./hash_util";import {$t} from "./i18n";import * as message_lists from "./message_lists";import * as message_store from "./message_store";-import * as muted_topics from "./muted_topics";import * as narrow from "./narrow";import * as narrow_state from "./narrow_state";import * as navigate from "./navigate";@@ -25,6 +24,7 @@ import * as ui from "./ui";import * as unread from "./unread";import * as unread_ops from "./unread_ops";import {user_settings} from "./user_settings";+import * as user_topics from "./user_topics";const notice_memory = new Map();@@ -378,10 +378,7 @@ export function message_is_notifiable(message) {return false;}- if (- message.type === "stream" &&- muted_topics.is_topic_muted(message.stream_id, message.topic)- ) {+ if (message.type === "stream" && user_topics.is_topic_muted(message.stream_id, message.topic)) {return false;}@@ -559,10 +556,7 @@ export function get_local_notify_mix_reason(message) {return undefined;}- if (- message.type === "stream" &&- muted_topics.is_topic_muted(message.stream_id, message.topic)- ) {+ if (message.type === "stream" && user_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/recent_topics_ui.js b/static/js/recent_topics_ui.jsindex a6cfe259017..c28ac2095a4 100644--- a/static/js/recent_topics_ui.js+++ b/static/js/recent_topics_ui.js@@ -14,7 +14,6 @@ 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 muted_topics from "./muted_topics";import * as narrow from "./narrow";import * as narrow_state from "./narrow_state";import * as navigate from "./navigate";@@ -30,6 +29,7 @@ import * as timerender from "./timerender";import * as top_left_corner from "./top_left_corner";import * as unread from "./unread";import * as unread_ui from "./unread_ui";+import * as user_topics from "./user_topics";let topics_widget;// Sets the number of avatars to display.@@ -267,7 +267,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(muted_topics.is_topic_muted(stream_id, topic));+ const topic_muted = Boolean(user_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);@@ -386,7 +386,7 @@ export function filters_should_hide_topic(topic_data) {}if (!filters.has("include_muted")) {- const topic_muted = Boolean(muted_topics.is_topic_muted(msg.stream_id, msg.topic));+ const topic_muted = Boolean(user_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 7f12ecdde32..8c9fee4b0c0 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 muted_topics from "./muted_topics";import * as muted_topics_ui from "./muted_topics_ui";import * as ui from "./ui";+import * as user_topics from "./user_topics";export let loaded = false;export function populate_list() {- const all_muted_topics = muted_topics.get_muted_topics();+ const all_muted_topics = user_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 1be1f3f4d7e..ae4cf291f53 100644--- a/static/js/stream_popover.js+++ b/static/js/stream_popover.js@@ -22,7 +22,6 @@ import {DropdownListWidget} from "./dropdown_list_widget";import * as hash_util from "./hash_util";import {$t, $t_html} from "./i18n";import * as message_edit from "./message_edit";-import * as muted_topics from "./muted_topics";import * as muted_topics_ui from "./muted_topics_ui";import {page_params} from "./page_params";import * as popovers from "./popovers";@@ -38,6 +37,7 @@ import * as sub_store from "./sub_store";import * as ui_report from "./ui_report";import * as unread_ops from "./unread_ops";import {user_settings} from "./user_settings";+import * as user_topics from "./user_topics";// We handle stream popovers and topic popovers in this// module. Both are popped up from the left sidebar.@@ -279,7 +279,7 @@ function build_topic_popover(opts) {popovers.hide_all();show_streamlist_sidebar();- const topic_muted = muted_topics.is_topic_muted(sub.stream_id, topic_name);+ const topic_muted = user_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 fbfe3f39e06..8b7704a93ca 100644--- a/static/js/topic_generator.js+++ b/static/js/topic_generator.js@@ -1,9 +1,9 @@-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";import * as stream_topic_history from "./stream_topic_history";import * as unread from "./unread";+import * as user_topics from "./user_topics";export function next_topic(streams, get_topics, has_unread_messages, curr_stream, curr_topic) {const curr_stream_index = streams.indexOf(curr_stream); // -1 if not found@@ -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) => !muted_topics.is_topic_muted(stream_id, topic));+ topics = topics.filter((topic) => !user_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 26c99d6c0c2..9647ff53e00 100644--- a/static/js/topic_list_data.js+++ b/static/js/topic_list_data.js@@ -1,11 +1,11 @@import * as resolved_topic from "../shared/js/resolved_topic";import * as hash_util from "./hash_util";-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";import * as unread from "./unread";+import * as user_topics from "./user_topics";import * as util from "./util";const max_topics = 5;@@ -32,7 +32,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 = muted_topics.is_topic_muted(stream_id, topic_name);+ const is_topic_muted = user_topics.is_topic_muted(stream_id, topic_name);const [topic_resolved_prefix, topic_display_name] =resolved_topic.display_parts(topic_name);diff --git a/static/js/ui_init.js b/static/js/ui_init.jsindex 6fd1e8f3f39..34bd10e4f8f 100644--- a/static/js/ui_init.js+++ b/static/js/ui_init.js@@ -50,7 +50,6 @@ 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 navbar_alerts from "./navbar_alerts";import * as navigate from "./navigate";@@ -103,6 +102,7 @@ import * as user_groups from "./user_groups";import {initialize_user_settings, user_settings} from "./user_settings";import * as user_status from "./user_status";import * as user_status_ui from "./user_status_ui";+import * as user_topics from "./user_topics";// This is where most of our initialization takes place.// TODO: Organize it a lot better. In particular, move bigger@@ -620,7 +620,7 @@ export function initialize_everything() {stream_edit_subscribers.initialize();stream_data.initialize(stream_data_params);pm_conversations.recent.initialize(pm_conversations_params);- muted_topics.initialize();+ user_topics.initialize();muted_users.initialize();stream_settings_ui.initialize();stream_list.initialize();diff --git a/static/js/unread.js b/static/js/unread.jsindex db4d039f7a2..8f58cbe13ac 100644--- a/static/js/unread.js+++ b/static/js/unread.js@@ -1,12 +1,12 @@import {FoldDict} from "./fold_dict";import * as message_store from "./message_store";-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";import * as stream_data from "./stream_data";import * as sub_store from "./sub_store";import {user_settings} from "./user_settings";+import * as user_topics from "./user_topics";import * as util from "./util";// The unread module tracks the message IDs and locations of the@@ -251,7 +251,7 @@ class UnreadTopicCounter {let stream_count = 0;for (const [topic, msgs] of per_stream_bucketer) {const topic_count = msgs.size;- if (!muted_topics.is_topic_muted(stream_id, topic)) {+ if (!user_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 && !muted_topics.is_topic_muted(stream_id, topic)) {+ if (sub && !user_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 && !muted_topics.is_topic_muted(stream_id, topic)) {+ if (sub && !user_topics.is_topic_muted(stream_id, topic)) {for (const id of id_set) {ids.push(id);}@@ -484,7 +484,7 @@ export function update_message_for_mention(message) {const is_unmuted_mention =message.type === "stream" &&message.mentioned &&- !muted_topics.is_topic_muted(message.stream_id, message.topic);+ !user_topics.is_topic_muted(message.stream_id, message.topic);if (is_unmuted_mention || message.mentioned_me_directly) {unread_mentions_counter.add(message.id);diff --git a/static/js/muted_topics.js b/static/js/user_topics.jssimilarity index 100%rename from static/js/muted_topics.jsrename to static/js/user_topics.js