From 32b201d5e0b2405a3df42692126bca5c830e18b5 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Sat, 24 Jun 2023 11:27:58 +0530 Subject: [PATCH] user_topics: Rename 'muted_topics_ui' to 'user_topics_ui'. This commit renames the file 'muted_topics_ui.js' to 'user_topics_ui.js', as we also support visibility policies other than MUTED. --- tools/test-js-with-node | 2 +- web/src/hotkey.js | 4 ++-- web/src/server_events_dispatch.js | 4 ++-- web/src/{muted_topics_ui.js => user_topics_ui.js} | 0 web/tests/dispatch.test.js | 4 ++-- web/tests/hotkey.test.js | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) rename web/src/{muted_topics_ui.js => user_topics_ui.js} (100%) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 6212d560ec..cb297d64d9 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -124,7 +124,6 @@ EXEMPT_FILES = make_set( "web/src/message_view_header.js", "web/src/message_viewport.js", "web/src/messages_overlay_ui.ts", - "web/src/muted_topics_ui.js", "web/src/muted_users_ui.js", "web/src/narrow.js", "web/src/navbar_alerts.js", @@ -230,6 +229,7 @@ EXEMPT_FILES = make_set( "web/src/user_status.js", "web/src/user_status_ui.js", "web/src/user_topics.js", + "web/src/user_topics_ui.js", "web/src/webpack_public_path.js", "web/src/zcommand.js", "web/src/zform.js", diff --git a/web/src/hotkey.js b/web/src/hotkey.js index 36dc54ac20..1c64406ba3 100644 --- a/web/src/hotkey.js +++ b/web/src/hotkey.js @@ -26,7 +26,6 @@ import * as list_util from "./list_util"; import * as message_edit from "./message_edit"; import * as message_lists from "./message_lists"; import * as message_scroll from "./message_scroll"; -import * as muted_topics_ui from "./muted_topics_ui"; import * as narrow from "./narrow"; import * as narrow_state from "./narrow_state"; import * as navigate from "./navigate"; @@ -48,6 +47,7 @@ import * as stream_settings_ui from "./stream_settings_ui"; import * as topic_zoom from "./topic_zoom"; import * as unread_ops from "./unread_ops"; import {user_settings} from "./user_settings"; +import * as user_topics_ui from "./user_topics_ui"; function do_narrow_action(action) { action(message_lists.current.selected_id(), {trigger: "hotkey"}); @@ -1027,7 +1027,7 @@ export function process_hotkey(e, hotkey) { return true; } case "toggle_topic_visibility_policy": - muted_topics_ui.toggle_topic_visibility_policy(msg); + user_topics_ui.toggle_topic_visibility_policy(msg); return true; case "toggle_message_collapse": condense.toggle_collapse(msg); diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js index 465e4fd3fe..2eb06415b5 100644 --- a/web/src/server_events_dispatch.js +++ b/web/src/server_events_dispatch.js @@ -23,7 +23,6 @@ import * as message_edit from "./message_edit"; import * as message_events from "./message_events"; import * as message_lists from "./message_lists"; import * as message_live_update from "./message_live_update"; -import * as muted_topics_ui from "./muted_topics_ui"; import * as muted_users_ui from "./muted_users_ui"; import * as narrow_state from "./narrow_state"; import * as navbar_alerts from "./navbar_alerts"; @@ -80,6 +79,7 @@ import * as user_groups from "./user_groups"; import * as user_groups_settings_ui from "./user_groups_settings_ui"; import {user_settings} from "./user_settings"; import * as user_status from "./user_status"; +import * as user_topics_ui from "./user_topics_ui"; export function dispatch_normal_event(event) { const noop = function () {}; @@ -904,7 +904,7 @@ export function dispatch_normal_event(event) { break; case "user_topic": - muted_topics_ui.handle_topic_updates(event); + user_topics_ui.handle_topic_updates(event); break; } } diff --git a/web/src/muted_topics_ui.js b/web/src/user_topics_ui.js similarity index 100% rename from web/src/muted_topics_ui.js rename to web/src/user_topics_ui.js diff --git a/web/tests/dispatch.test.js b/web/tests/dispatch.test.js index fcbf27f80a..fc83f00edb 100644 --- a/web/tests/dispatch.test.js +++ b/web/tests/dispatch.test.js @@ -31,7 +31,7 @@ const hotspots = mock_esm("../src/hotspots"); const linkifiers = mock_esm("../src/linkifiers"); const message_events = mock_esm("../src/message_events"); const message_lists = mock_esm("../src/message_lists"); -const muted_topics_ui = mock_esm("../src/muted_topics_ui"); +const user_topics_ui = mock_esm("../src/user_topics_ui"); const muted_users_ui = mock_esm("../src/muted_users_ui"); const notifications = mock_esm("../src/notifications"); const pm_list = mock_esm("../src/pm_list"); @@ -322,7 +322,7 @@ run_test("muted_topics", ({override}) => { const event = event_fixtures.user_topic; const stub = make_stub(); - override(muted_topics_ui, "handle_topic_updates", stub.f); + override(user_topics_ui, "handle_topic_updates", stub.f); dispatch(event); assert.equal(stub.num_calls, 1); const args = stub.get_args("user_topic"); diff --git a/web/tests/hotkey.test.js b/web/tests/hotkey.test.js index 1c2d3debb1..fe9e8088cc 100644 --- a/web/tests/hotkey.test.js +++ b/web/tests/hotkey.test.js @@ -47,7 +47,7 @@ const lightbox = mock_esm("../src/lightbox"); const list_util = mock_esm("../src/list_util"); const message_edit = mock_esm("../src/message_edit"); const message_lists = mock_esm("../src/message_lists"); -const muted_topics_ui = mock_esm("../src/muted_topics_ui"); +const user_topics_ui = mock_esm("../src/user_topics_ui"); const narrow = mock_esm("../src/narrow"); const narrow_state = mock_esm("../src/narrow_state", { is_message_feed_visible: () => true, @@ -425,7 +425,7 @@ run_test("emoji picker", ({override}) => { run_test("G/M keys", () => { // TODO: move assert_mapping("G", navigate, "to_end"); - assert_mapping("M", muted_topics_ui, "toggle_topic_visibility_policy"); + assert_mapping("M", user_topics_ui, "toggle_topic_visibility_policy"); }); run_test("n/p keys", () => {