diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 6293f74a66..b58a4a7af4 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -146,7 +146,7 @@ EXEMPT_FILES = make_set( "web/src/realm_logo.js", "web/src/realm_playground.ts", "web/src/realm_user_settings_defaults.ts", - "web/src/recent_topics_ui.js", + "web/src/recent_view_ui.js", "web/src/recent_topics_util.js", "web/src/reload.js", "web/src/reminder.js", diff --git a/web/src/click_handlers.js b/web/src/click_handlers.js index 34f9eade5f..778d60b7bd 100644 --- a/web/src/click_handlers.js +++ b/web/src/click_handlers.js @@ -29,7 +29,7 @@ import {page_params} from "./page_params"; import * as pm_list from "./pm_list"; import * as popovers from "./popovers"; import * as reactions from "./reactions"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as rows from "./rows"; import * as server_events from "./server_events"; import * as settings_display from "./settings_display"; @@ -641,7 +641,7 @@ export function initialize() { if (!user_ids_string || user_ids_string.split(",").length !== 1) { return; } - const title_data = recent_topics_ui.get_pm_tooltip_data(user_ids_string); + const title_data = recent_view_ui.get_pm_tooltip_data(user_ids_string); const noop = () => {}; do_render_buddy_list_tooltip($elem, title_data, noop, noop, false, undefined, false); }); diff --git a/web/src/compose_actions.js b/web/src/compose_actions.js index 9892b87986..a7495a00e3 100644 --- a/web/src/compose_actions.js +++ b/web/src/compose_actions.js @@ -21,7 +21,7 @@ import * as message_viewport from "./message_viewport"; import * as narrow_state from "./narrow_state"; import {page_params} from "./page_params"; import * as people from "./people"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as recent_topics_util from "./recent_topics_util"; import * as reload_state from "./reload_state"; import * as resize from "./resize"; @@ -308,7 +308,7 @@ export function respond_to_message(opts) { let message; let msg_type; if (recent_topics_util.is_visible()) { - message = recent_topics_ui.get_focused_row_message(); + message = recent_view_ui.get_focused_row_message(); if (message === undefined) { // Open empty compose with nothing pre-filled since // user is not focused on any table row. diff --git a/web/src/hashchange.js b/web/src/hashchange.js index 93dd712e44..033fe4ecb1 100644 --- a/web/src/hashchange.js +++ b/web/src/hashchange.js @@ -17,7 +17,7 @@ import * as navigate from "./navigate"; import * as overlays from "./overlays"; import {page_params} from "./page_params"; import * as popovers from "./popovers"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as recent_topics_util from "./recent_topics_util"; import * as scheduled_messages_overlay_ui from "./scheduled_messages_overlay_ui"; import * as settings from "./settings"; @@ -85,7 +85,7 @@ function set_hash(hash) { function maybe_hide_recent_topics() { if (recent_topics_util.is_visible()) { - recent_topics_ui.hide(); + recent_view_ui.hide(); return true; } return false; @@ -141,7 +141,7 @@ function show_default_view() { // We only allow all_messages and recent_topics // to be rendered without a hash. if (user_settings.default_view === "recent_topics") { - recent_topics_ui.show(); + recent_view_ui.show(); } else if (user_settings.default_view === "all_messages") { show_all_message_view(); } else { @@ -221,11 +221,11 @@ function do_hashchange_normal(from_reload) { // for #recent permanently. We show the view and then // replace the current URL hash in a way designed to hide // this detail in the browser's forward/back session history. - recent_topics_ui.show(); + recent_view_ui.show(); window.location.replace("#recent"); break; case "#recent": - recent_topics_ui.show(); + recent_view_ui.show(); break; case "#all_messages": show_all_message_view(); diff --git a/web/src/hotkey.js b/web/src/hotkey.js index f9b979a3a8..cd885441cd 100644 --- a/web/src/hotkey.js +++ b/web/src/hotkey.js @@ -35,7 +35,7 @@ import {page_params} from "./page_params"; import * as popover_menus from "./popover_menus"; import * as popovers from "./popovers"; import * as reactions from "./reactions"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as recent_topics_util from "./recent_topics_util"; import * as scheduled_messages_overlay_ui from "./scheduled_messages_overlay_ui"; import * as search from "./search"; @@ -239,10 +239,10 @@ export function in_content_editable_widget(e) { // Returns true if we handled it, false if the browser should. export function process_escape_key(e) { if ( - recent_topics_ui.is_in_focus() && + recent_view_ui.is_in_focus() && // This will return false if `e.target` is not // any of the Recent Conversations elements by design. - recent_topics_ui.change_focused_element($(e.target), "escape") + recent_view_ui.change_focused_element($(e.target), "escape") ) { // Recent Conversations uses escape to switch focus from // search / filters to the conversations table. If focus is @@ -494,7 +494,7 @@ export function process_enter_key(e) { // focused (say, during the race or after clicking on the // sidebars, it's worth focusing the table so that hitting // `Enter` again will navigate you somewhere. - const focus_changed = recent_topics_ui.revive_current_focus(); + const focus_changed = recent_view_ui.revive_current_focus(); return focus_changed; } @@ -626,8 +626,8 @@ export function process_hotkey(e, hotkey) { case "tab": case "shift_tab": case "open_recent_topics": - if (recent_topics_ui.is_in_focus()) { - return recent_topics_ui.change_focused_element($(e.target), event_name); + if (recent_view_ui.is_in_focus()) { + return recent_view_ui.change_focused_element($(e.target), event_name); } } diff --git a/web/src/message_events.js b/web/src/message_events.js index 4d269c4e12..74eaa457b0 100644 --- a/web/src/message_events.js +++ b/web/src/message_events.js @@ -21,8 +21,8 @@ import * as notifications from "./notifications"; import {page_params} from "./page_params"; import * as pm_list from "./pm_list"; import * as recent_senders from "./recent_senders"; -import * as recent_topics_ui from "./recent_topics_ui"; import * as recent_topics_util from "./recent_topics_util"; +import * as recent_view_ui from "./recent_view_ui"; import * as starred_messages from "./starred_messages"; import * as starred_messages_ui from "./starred_messages_ui"; import * as stream_list from "./stream_list"; @@ -164,7 +164,7 @@ export function insert_new_messages(messages, sent_by_this_client) { notifications.received_messages(messages); stream_list.update_streams_sidebar(); pm_list.update_private_messages(); - recent_topics_ui.process_messages(messages); + recent_view_ui.process_messages(messages); } export function update_messages(events) { @@ -236,7 +236,7 @@ export function update_messages(events) { anchor_message.stream_id, anchor_message.topic, ); - recent_topics_ui.inplace_rerender(topic_key); + recent_view_ui.inplace_rerender(topic_key); } } @@ -510,7 +510,7 @@ export function update_messages(events) { new_topic: post_edit_topic, }); unread.clear_and_populate_unread_mention_topics(); - recent_topics_ui.process_topic_edit(...args); + recent_view_ui.process_topic_edit(...args); } // Rerender "Message edit history" if it was open to the edited message. @@ -570,7 +570,7 @@ export function remove_messages(message_ids) { list.remove_and_rerender(message_ids); } recent_senders.update_topics_of_deleted_message_ids(message_ids); - recent_topics_ui.update_topics_of_deleted_message_ids(message_ids); + recent_view_ui.update_topics_of_deleted_message_ids(message_ids); starred_messages.remove(message_ids); starred_messages_ui.rerender_ui(); } diff --git a/web/src/message_fetch.js b/web/src/message_fetch.js index e7128539a0..d795484445 100644 --- a/web/src/message_fetch.js +++ b/web/src/message_fetch.js @@ -13,7 +13,7 @@ import * as message_util from "./message_util"; import * as narrow_banner from "./narrow_banner"; import {page_params} from "./page_params"; import * as people from "./people"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as stream_data from "./stream_data"; import * as stream_list from "./stream_list"; import * as ui_report from "./ui_report"; @@ -52,7 +52,7 @@ function process_result(data, opts) { } huddle_data.process_loaded_messages(messages); - recent_topics_ui.process_messages(messages); + recent_view_ui.process_messages(messages); stream_list.update_streams_sidebar(); stream_list.maybe_scroll_narrow_into_view(); @@ -477,7 +477,7 @@ export function initialize(home_view_loaded) { if (page_params.is_spectator) { // Since for spectators, this is the main fetch, we // hide the Recent Conversations loading indicator here. - recent_topics_ui.hide_loading_indicator(); + recent_view_ui.hide_loading_indicator(); } // See server_events.js for this callback. @@ -524,7 +524,7 @@ export function initialize(home_view_loaded) { // This optimization requires a bit of duplicated loading // indicator code, here and hiding logic in hide_more. - recent_topics_ui.show_loading_indicator(); + recent_view_ui.show_loading_indicator(); return; } @@ -557,12 +557,12 @@ export function initialize(home_view_loaded) { // at both top and bottom be managed by load_messages, but that // likely depends on other reorganizations of the early loading // sequence. - recent_topics_ui.show_loading_indicator(); + recent_view_ui.show_loading_indicator(); load_messages({ anchor: "newest", num_before: consts.recent_topics_initial_fetch_size, num_after: 0, msg_list: recent_topics_message_list, - cont: recent_topics_ui.hide_loading_indicator, + cont: recent_view_ui.hide_loading_indicator, }); } diff --git a/web/src/muted_users_ui.js b/web/src/muted_users_ui.js index 083605a039..6251ae49ef 100644 --- a/web/src/muted_users_ui.js +++ b/web/src/muted_users_ui.js @@ -10,7 +10,7 @@ import * as overlays from "./overlays"; import * as people from "./people"; import * as pm_list from "./pm_list"; import * as popovers from "./popovers"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as settings_muted_users from "./settings_muted_users"; export function mute_user(user_id) { @@ -57,7 +57,7 @@ export function rerender_for_muted_user() { // If a user is (un)muted, we want to update their avatars on the Recent Conversations // participants column. - recent_topics_ui.complete_rerender(); + recent_view_ui.complete_rerender(); } export function handle_user_updates(muted_user_ids) { diff --git a/web/src/narrow.js b/web/src/narrow.js index 76fc6b9998..cf8b320df2 100644 --- a/web/src/narrow.js +++ b/web/src/narrow.js @@ -33,8 +33,8 @@ import * as notifications from "./notifications"; import {page_params} from "./page_params"; import * as people from "./people"; import * as pm_list from "./pm_list"; -import * as recent_topics_ui from "./recent_topics_ui"; import * as recent_topics_util from "./recent_topics_util"; +import * as recent_view_ui from "./recent_view_ui"; import * as resize from "./resize"; import * as search from "./search"; import {web_mark_read_on_scroll_policy_values} from "./settings_config"; @@ -380,7 +380,7 @@ export function activate(raw_operators, opts) { reset_ui_state(); if (coming_from_recent_topics) { - recent_topics_ui.hide(); + recent_view_ui.hide(); } else { // If Recent Conversations was not visible, then we are switching // from another message list view. Save the scroll position in diff --git a/web/src/recent_topics_ui.js b/web/src/recent_view_ui.js similarity index 100% rename from web/src/recent_topics_ui.js rename to web/src/recent_view_ui.js diff --git a/web/src/stream_events.js b/web/src/stream_events.js index b08341b06f..eb290a043a 100644 --- a/web/src/stream_events.js +++ b/web/src/stream_events.js @@ -10,7 +10,7 @@ import * as narrow_state from "./narrow_state"; import * as overlays from "./overlays"; import * as peer_data from "./peer_data"; import * as people from "./people"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as settings_notifications from "./settings_notifications"; import * as stream_color from "./stream_color"; import * as stream_data from "./stream_data"; @@ -54,7 +54,7 @@ export function update_property(stream_id, property, value, other_values) { case "is_muted": stream_muting.update_is_muted(sub, value); stream_list.refresh_muted_or_unmuted_stream(sub); - recent_topics_ui.complete_rerender(); + recent_view_ui.complete_rerender(); break; case "desktop_notifications": case "audible_notifications": diff --git a/web/src/ui_init.js b/web/src/ui_init.js index 3daf815a44..a3732c1f47 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -74,7 +74,7 @@ import * as presence from "./presence"; import * as realm_logo from "./realm_logo"; import * as realm_playground from "./realm_playground"; import * as realm_user_settings_defaults from "./realm_user_settings_defaults"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as reload from "./reload"; import * as rendered_markdown from "./rendered_markdown"; import * as resize from "./resize"; @@ -678,7 +678,7 @@ export function initialize_everything() { realm_logo.initialize(); message_lists.initialize(); - recent_topics_ui.initialize(); + recent_view_ui.initialize(); alert_words.initialize(alert_words_params); emojisets.initialize(); scroll_bar.initialize(); diff --git a/web/src/unread_ops.js b/web/src/unread_ops.js index b1d88e85f3..9ea902e50c 100644 --- a/web/src/unread_ops.js +++ b/web/src/unread_ops.js @@ -16,7 +16,7 @@ import * as narrow_state from "./narrow_state"; import * as notifications from "./notifications"; import * as overlays from "./overlays"; import * as people from "./people"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as ui_report from "./ui_report"; import * as unread from "./unread"; import * as unread_ui from "./unread_ui"; @@ -166,7 +166,7 @@ function process_newly_read_message(message, options) { msg_list.view.show_message_as_read(message, options); } notifications.close_notification(message); - recent_topics_ui.update_topic_unread_count(message); + recent_view_ui.update_topic_unread_count(message); } export function mark_as_unread_from_here( @@ -376,7 +376,7 @@ export function process_unread_messages_event({message_ids, message_details}) { list.view.show_messages_as_unread(message_ids); } - recent_topics_ui.complete_rerender(); + recent_view_ui.complete_rerender(); if ( !message_lists.current.can_mark_messages_read() && diff --git a/web/src/user_topics_ui.js b/web/src/user_topics_ui.js index dade539ed7..e115542a55 100644 --- a/web/src/user_topics_ui.js +++ b/web/src/user_topics_ui.js @@ -3,7 +3,7 @@ import $ from "jquery"; import * as message_lists from "./message_lists"; import * as overlays from "./overlays"; import * as popover_menus from "./popover_menus"; -import * as recent_topics_ui from "./recent_topics_ui"; +import * as recent_view_ui from "./recent_view_ui"; import * as settings_user_topics from "./settings_user_topics"; import * as stream_list from "./stream_list"; import * as sub_store from "./sub_store"; @@ -21,7 +21,7 @@ export function handle_topic_updates(user_topic_event) { if (message_lists.current !== message_lists.home) { message_lists.home.update_muting_and_rerender(); } - recent_topics_ui.update_topic_visibility_policy( + recent_view_ui.update_topic_visibility_policy( user_topic_event.stream_id, user_topic_event.topic_name, ); diff --git a/web/tests/hashchange.test.js b/web/tests/hashchange.test.js index c51e8763f9..8ff6ba925d 100644 --- a/web/tests/hashchange.test.js +++ b/web/tests/hashchange.test.js @@ -21,7 +21,7 @@ const message_viewport = mock_esm("../src/message_viewport"); const narrow = mock_esm("../src/narrow"); const overlays = mock_esm("../src/overlays"); const popovers = mock_esm("../src/popovers"); -const recent_topics_ui = mock_esm("../src/recent_topics_ui"); +const recent_view_ui = mock_esm("../src/recent_view_ui"); const settings = mock_esm("../src/settings"); const stream_settings_ui = mock_esm("../src/stream_settings_ui"); const ui_util = mock_esm("../src/ui_util"); @@ -173,9 +173,9 @@ run_test("hash_interactions", ({override}) => { const helper = test_helper({override, change_tab: true}); - let recent_topics_ui_shown = false; - override(recent_topics_ui, "show", () => { - recent_topics_ui_shown = true; + let recent_view_ui_shown = false; + override(recent_view_ui, "show", () => { + recent_view_ui_shown = true; }); let hide_all_called = false; override(popovers, "hide_all", () => { @@ -186,7 +186,7 @@ run_test("hash_interactions", ({override}) => { browser_history.clear_for_testing(); hashchange.initialize(); // If it's an unknown hash it should show the default view. - assert.equal(recent_topics_ui_shown, true); + assert.equal(recent_view_ui_shown, true); assert.equal(hide_all_called, true); helper.assert_events([ [overlays, "close_for_hash_change"], @@ -214,12 +214,12 @@ run_test("hash_interactions", ({override}) => { ]); // Test old "#recent_topics" hash redirects to "#recent". - recent_topics_ui_shown = false; + recent_view_ui_shown = false; window.location.hash = "#recent_topics"; helper.clear_events(); $window_stub.trigger("hashchange"); - assert.equal(recent_topics_ui_shown, true); + assert.equal(recent_view_ui_shown, true); helper.assert_events([ [overlays, "close_for_hash_change"], [message_viewport, "stop_auto_scrolling"], @@ -270,14 +270,14 @@ run_test("hash_interactions", ({override}) => { [stream_settings_ui, "launch"], ]); - recent_topics_ui_shown = false; + recent_view_ui_shown = false; window.location.hash = "#reload:send_after_reload=0..."; helper.clear_events(); $window_stub.trigger("hashchange"); helper.assert_events([]); // If it's reload hash it shouldn't show the default view. - assert.equal(recent_topics_ui_shown, false); + assert.equal(recent_view_ui_shown, false); window.location.hash = "#keyboard-shortcuts/whatever"; diff --git a/web/tests/hotkey.test.js b/web/tests/hotkey.test.js index c931d5222b..4c72fad54a 100644 --- a/web/tests/hotkey.test.js +++ b/web/tests/hotkey.test.js @@ -84,7 +84,7 @@ mock_esm("../src/hotspots", { is_open: () => false, }); -mock_esm("../src/recent_topics_ui", { +mock_esm("../src/recent_view_ui", { is_in_focus: () => false, }); diff --git a/web/tests/message_fetch.test.js b/web/tests/message_fetch.test.js index cdec50221f..e92d840a9c 100644 --- a/web/tests/message_fetch.test.js +++ b/web/tests/message_fetch.test.js @@ -24,7 +24,7 @@ mock_esm("../src/message_list_view", { MessageListView, }); -mock_esm("../src/recent_topics_ui", { +mock_esm("../src/recent_view_ui", { process_messages: noop, show_loading_indicator: noop, hide_loading_indicator: noop, diff --git a/web/tests/recent_topics.test.js b/web/tests/recent_topics.test.js index dabf1c14e2..29df8cc131 100644 --- a/web/tests/recent_topics.test.js +++ b/web/tests/recent_topics.test.js @@ -191,7 +191,7 @@ mock_esm("../src/resize", { const {all_messages_data} = zrequire("all_messages_data"); const people = zrequire("people"); -const rt = zrequire("recent_topics_ui"); +const rt = zrequire("recent_view_ui"); const recent_topics_util = zrequire("recent_topics_util"); const rt_data = zrequire("recent_topics_data"); const muted_users = zrequire("muted_users"); diff --git a/web/tests/stream_events.test.js b/web/tests/stream_events.test.js index acd8f173cc..07f759bd60 100644 --- a/web/tests/stream_events.test.js +++ b/web/tests/stream_events.test.js @@ -26,7 +26,7 @@ const message_lists = mock_esm("../src/message_lists", { const message_view_header = mock_esm("../src/message_view_header", { maybe_rerender_title_area_for_stream() {}, }); -mock_esm("../src/recent_topics_ui", { +mock_esm("../src/recent_view_ui", { complete_rerender() {}, }); mock_esm("../src/settings_notifications", {