diff --git a/web/src/hashchange.js b/web/src/hashchange.js index d710114ce0..4a6a5b29cf 100644 --- a/web/src/hashchange.js +++ b/web/src/hashchange.js @@ -8,6 +8,7 @@ import * as drafts from "./drafts"; import * as hash_util from "./hash_util"; import {$t_html} from "./i18n"; import * as info_overlay from "./info_overlay"; +import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area"; import * as message_lists from "./message_lists"; import * as message_scroll from "./message_scroll"; import * as message_viewport from "./message_viewport"; @@ -24,7 +25,6 @@ import * as settings_panel_menu from "./settings_panel_menu"; import * as settings_toggle from "./settings_toggle"; import * as spectators from "./spectators"; import * as stream_settings_ui from "./stream_settings_ui"; -import * as top_left_corner from "./top_left_corner"; import * as ui_report from "./ui_report"; import * as user_groups_settings_ui from "./user_groups_settings_ui"; import {user_settings} from "./user_settings"; @@ -112,7 +112,7 @@ function show_all_message_view() { const coming_from_recent_topics = maybe_hide_recent_topics(); const is_actively_scrolling = message_scroll.is_actively_scrolling(); narrow.deactivate(coming_from_recent_topics, is_actively_scrolling); - top_left_corner.handle_narrow_deactivated(); + left_sidebar_navigation_area.handle_narrow_deactivated(); // We need to maybe scroll to the selected message // once we have the proper viewport set up setTimeout(navigate.maybe_scroll_to_selected, 0); diff --git a/web/src/top_left_corner.js b/web/src/left_sidebar_navigation_area.js similarity index 100% rename from web/src/top_left_corner.js rename to web/src/left_sidebar_navigation_area.js diff --git a/web/src/narrow.js b/web/src/narrow.js index 91c4ce27e8..2c8c1a1a6f 100644 --- a/web/src/narrow.js +++ b/web/src/narrow.js @@ -15,6 +15,7 @@ import {Filter} from "./filter"; import * as hash_util from "./hash_util"; import * as hashchange from "./hashchange"; import {$t} from "./i18n"; +import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area"; import * as message_edit from "./message_edit"; import * as message_feed_loading from "./message_feed_loading"; import * as message_feed_top_notices from "./message_feed_top_notices"; @@ -39,7 +40,6 @@ import {web_mark_read_on_scroll_policy_values} from "./settings_config"; import * as spectators from "./spectators"; import * as stream_data from "./stream_data"; import * as stream_list from "./stream_list"; -import * as top_left_corner from "./top_left_corner"; import * as topic_generator from "./topic_generator"; import * as typing_events from "./typing_events"; import * as unread from "./unread"; @@ -542,7 +542,7 @@ export function activate(raw_operators, opts) { const current_filter = narrow_state.filter(); - top_left_corner.handle_narrow_activated(current_filter); + left_sidebar_navigation_area.handle_narrow_activated(current_filter); pm_list.handle_narrow_activated(current_filter); stream_list.handle_narrow_activated(current_filter); typing_events.render_notifications_for_narrow(); @@ -991,7 +991,7 @@ export function to_compose_target() { function handle_post_narrow_deactivate_processes() { compose_fade.update_message_list(); - top_left_corner.handle_narrow_deactivated(); + left_sidebar_navigation_area.handle_narrow_deactivated(); pm_list.handle_narrow_deactivated(); stream_list.handle_narrow_deactivated(); compose_closed_ui.update_buttons_for_stream(); diff --git a/web/src/recent_topics_ui.js b/web/src/recent_topics_ui.js index 92cacccfe3..8f821b1f88 100644 --- a/web/src/recent_topics_ui.js +++ b/web/src/recent_topics_ui.js @@ -11,6 +11,7 @@ import * as buddy_data from "./buddy_data"; import * as compose_closed_ui from "./compose_closed_ui"; import * as hash_util from "./hash_util"; import {$t} from "./i18n"; +import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area"; import * as ListWidget from "./list_widget"; import * as loading from "./loading"; import {localstorage} from "./localstorage"; @@ -41,7 +42,6 @@ import * as stream_data from "./stream_data"; import * as stream_list from "./stream_list"; import * as sub_store from "./sub_store"; import * as timerender from "./timerender"; -import * as top_left_corner from "./top_left_corner"; import * as ui_util from "./ui_util"; import * as unread from "./unread"; import * as unread_ops from "./unread_ops"; @@ -886,7 +886,7 @@ export function show() { return; } // Hide selected elements in the left sidebar. - top_left_corner.narrow_to_recent_topics(); + left_sidebar_navigation_area.narrow_to_recent_topics(); stream_list.handle_narrow_deactivated(); // Hide "middle-column" which has html for rendering diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js index 2eb06415b5..be27a483ac 100644 --- a/web/src/server_events_dispatch.js +++ b/web/src/server_events_dispatch.js @@ -18,6 +18,7 @@ import * as emoji from "./emoji"; import * as emoji_picker from "./emoji_picker"; import * as giphy from "./giphy"; import * as hotspots from "./hotspots"; +import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area"; import * as linkifiers from "./linkifiers"; import * as message_edit from "./message_edit"; import * as message_events from "./message_events"; @@ -69,7 +70,6 @@ import * as stream_topic_history from "./stream_topic_history"; import * as stream_ui_updates from "./stream_ui_updates"; import * as sub_store from "./sub_store"; import * as submessage from "./submessage"; -import * as top_left_corner from "./top_left_corner"; import * as typing_events from "./typing_events"; import * as unread_ops from "./unread_ops"; import * as unread_ui from "./unread_ui"; @@ -475,7 +475,7 @@ export function dispatch_normal_event(event) { case "add": { scheduled_messages.add_scheduled_messages(event.scheduled_messages); scheduled_messages_overlay_ui.rerender(); - top_left_corner.update_scheduled_messages_row(); + left_sidebar_navigation_area.update_scheduled_messages_row(); break; } case "remove": { @@ -483,13 +483,13 @@ export function dispatch_normal_event(event) { scheduled_messages_overlay_ui.remove_scheduled_message_id( event.scheduled_message_id, ); - top_left_corner.update_scheduled_messages_row(); + left_sidebar_navigation_area.update_scheduled_messages_row(); break; } case "update": { scheduled_messages.update_scheduled_message(event.scheduled_message); scheduled_messages_overlay_ui.rerender(); - top_left_corner.update_scheduled_messages_row(); + left_sidebar_navigation_area.update_scheduled_messages_row(); break; } // No default diff --git a/web/src/starred_messages_ui.js b/web/src/starred_messages_ui.js index 3799540afc..d857370196 100644 --- a/web/src/starred_messages_ui.js +++ b/web/src/starred_messages_ui.js @@ -3,13 +3,13 @@ import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_di import * as confirm_dialog from "./confirm_dialog"; import {$t_html} from "./i18n"; +import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area"; import * as message_flags from "./message_flags"; import * as message_live_update from "./message_live_update"; import * as message_store from "./message_store"; import * as popover_menus from "./popover_menus"; import * as starred_messages from "./starred_messages"; import * as sub_store from "./sub_store"; -import * as top_left_corner from "./top_left_corner"; import * as unread_ops from "./unread_ops"; import {user_settings} from "./user_settings"; @@ -65,7 +65,7 @@ export function rerender_ui() { popover_menus.get_topic_menu_popover()?.hide(); popover_menus.get_starred_messages_popover()?.hide(); - top_left_corner.update_starred_count(count); + left_sidebar_navigation_area.update_starred_count(count); } export function confirm_unstar_all_messages() { diff --git a/web/src/ui_init.js b/web/src/ui_init.js index 77f3262b53..e8eaa7fa2f 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -42,6 +42,7 @@ import * as hotkey from "./hotkey"; import * as hotspots from "./hotspots"; import * as i18n from "./i18n"; import * as invite from "./invite"; +import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area"; import * as lightbox from "./lightbox"; import * as linkifiers from "./linkifiers"; import {localstorage} from "./localstorage"; @@ -104,7 +105,6 @@ import * as stream_settings_ui from "./stream_settings_ui"; import * as sub_store from "./sub_store"; import * as timerender from "./timerender"; import * as tippyjs from "./tippyjs"; -import * as top_left_corner from "./top_left_corner"; import * as topic_list from "./topic_list"; import * as topic_zoom from "./topic_zoom"; import * as tutorial from "./tutorial"; @@ -465,7 +465,7 @@ function initialize_unread_ui() { activity.update_dom_with_unread_counts(counts), ); unread_ui.register_update_unread_counts_hook((counts, skip_animations) => - top_left_corner.update_dom_with_unread_counts(counts, skip_animations), + left_sidebar_navigation_area.update_dom_with_unread_counts(counts, skip_animations), ); unread_ui.register_update_unread_counts_hook((counts) => stream_list.update_dom_with_unread_counts(counts), @@ -680,7 +680,7 @@ export function initialize_everything() { muted_users.initialize(muted_users_params); stream_settings_ui.initialize(); user_group_settings_ui.initialize(); - top_left_corner.initialize(); + left_sidebar_navigation_area.initialize(); stream_list.initialize({ on_stream_click(stream_id, trigger) { const sub = sub_store.get(stream_id); diff --git a/web/tests/dispatch.test.js b/web/tests/dispatch.test.js index fc83f00edb..ceee72de69 100644 --- a/web/tests/dispatch.test.js +++ b/web/tests/dispatch.test.js @@ -71,7 +71,7 @@ const stream_ui_updates = mock_esm("../src/stream_ui_updates", { update_announce_stream_option() {}, }); const submessage = mock_esm("../src/submessage"); -mock_esm("../src/top_left_corner", { +mock_esm("../src/left_sidebar_navigation_area", { update_starred_count() {}, update_scheduled_messages_row() {}, }); diff --git a/web/tests/hashchange.test.js b/web/tests/hashchange.test.js index ee782dc35b..c51e8763f9 100644 --- a/web/tests/hashchange.test.js +++ b/web/tests/hashchange.test.js @@ -26,7 +26,7 @@ const settings = mock_esm("../src/settings"); const stream_settings_ui = mock_esm("../src/stream_settings_ui"); const ui_util = mock_esm("../src/ui_util"); const ui_report = mock_esm("../src/ui_report"); -mock_esm("../src/top_left_corner", { +mock_esm("../src/left_sidebar_navigation_area", { handle_narrow_deactivated() {}, }); set_global("favicon", {}); diff --git a/web/tests/top_left_corner.test.js b/web/tests/left_sidebar_navigation_area.test.js similarity index 76% rename from web/tests/top_left_corner.test.js rename to web/tests/left_sidebar_navigation_area.test.js index 306a08a0b1..23d4162bc8 100644 --- a/web/tests/top_left_corner.test.js +++ b/web/tests/left_sidebar_navigation_area.test.js @@ -15,27 +15,27 @@ const scheduled_messages = mock_esm("../src/scheduled_messages"); scheduled_messages.get_count = () => 555; const {Filter} = zrequire("../src/filter"); -const top_left_corner = zrequire("top_left_corner"); +const left_sidebar_navigation_area = zrequire("left_sidebar_navigation_area"); run_test("narrowing", () => { let filter = new Filter([{operator: "is", operand: "mentioned"}]); // activating narrow - top_left_corner.handle_narrow_activated(filter); + left_sidebar_navigation_area.handle_narrow_activated(filter); assert.ok($(".top_left_mentions").hasClass("active-filter")); filter = new Filter([{operator: "is", operand: "starred"}]); - top_left_corner.handle_narrow_activated(filter); + left_sidebar_navigation_area.handle_narrow_activated(filter); assert.ok($(".top_left_starred_messages").hasClass("active-filter")); filter = new Filter([{operator: "in", operand: "home"}]); - top_left_corner.handle_narrow_activated(filter); + left_sidebar_navigation_area.handle_narrow_activated(filter); assert.ok($(".top_left_all_messages").hasClass("active-filter")); // deactivating narrow - top_left_corner.handle_narrow_deactivated(); + left_sidebar_navigation_area.handle_narrow_deactivated(); assert.ok($(".top_left_all_messages").hasClass("active-filter")); assert.ok(!$(".top_left_mentions").hasClass("active-filter")); @@ -45,7 +45,7 @@ run_test("narrowing", () => { set_global("setTimeout", (f) => { f(); }); - top_left_corner.narrow_to_recent_topics(); + left_sidebar_navigation_area.narrow_to_recent_topics(); assert.ok(!$(".top_left_all_messages").hasClass("active-filter")); assert.ok(!$(".top_left_mentions").hasClass("active-filter")); assert.ok(!$(".top_left_starred_messages").hasClass("active-filter")); @@ -74,10 +74,10 @@ run_test("update_count_in_dom", () => { make_elem($(".top_left_scheduled_messages"), ""); - top_left_corner.update_dom_with_unread_counts(counts, false); - top_left_corner.update_starred_count(444); - // Calls top_left_corner.update_scheduled_messages_row - top_left_corner.initialize(); + left_sidebar_navigation_area.update_dom_with_unread_counts(counts, false); + left_sidebar_navigation_area.update_starred_count(444); + // Calls left_sidebar_navigation_area.update_scheduled_messages_row + left_sidebar_navigation_area.initialize(); assert.equal($("").text(), "222"); assert.equal($("").text(), "333"); @@ -87,9 +87,9 @@ run_test("update_count_in_dom", () => { counts.mentioned_message_count = 0; scheduled_messages.get_count = () => 0; - top_left_corner.update_dom_with_unread_counts(counts, false); - top_left_corner.update_starred_count(0); - top_left_corner.update_scheduled_messages_row(); + left_sidebar_navigation_area.update_dom_with_unread_counts(counts, false); + left_sidebar_navigation_area.update_starred_count(0); + left_sidebar_navigation_area.update_scheduled_messages_row(); assert.ok(!$("").visible()); assert.equal($("").text(), ""); diff --git a/web/tests/message_flags.test.js b/web/tests/message_flags.test.js index 66556e704d..b512069174 100644 --- a/web/tests/message_flags.test.js +++ b/web/tests/message_flags.test.js @@ -16,7 +16,7 @@ mock_esm("../src/starred_messages", { get_starred_msg_ids: () => [1, 2, 3, 4, 5], remove() {}, }); -mock_esm("../src/top_left_corner", { +mock_esm("../src/left_sidebar_navigation_area", { update_starred_count() {}, }); diff --git a/web/tests/narrow_activate.test.js b/web/tests/narrow_activate.test.js index d3e3fe1384..d36f41402f 100644 --- a/web/tests/narrow_activate.test.js +++ b/web/tests/narrow_activate.test.js @@ -29,7 +29,7 @@ const message_feed_loading = mock_esm("../src/message_feed_loading"); const message_view_header = mock_esm("../src/message_view_header"); const notifications = mock_esm("../src/notifications"); const stream_list = mock_esm("../src/stream_list"); -const top_left_corner = mock_esm("../src/top_left_corner"); +const left_sidebar_navigation_area = mock_esm("../src/left_sidebar_navigation_area"); const typing_events = mock_esm("../src/typing_events"); const unread_ops = mock_esm("../src/unread_ops"); mock_esm("../src/recent_topics_util", { @@ -89,7 +89,7 @@ function test_helper() { stub(notifications, "redraw_title"); stub(stream_list, "handle_narrow_activated"); stub(message_view_header, "render_title_area"); - stub(top_left_corner, "handle_narrow_activated"); + stub(left_sidebar_navigation_area, "handle_narrow_activated"); stub(typing_events, "render_notifications_for_narrow"); stub(compose_recipient, "update_narrow_to_recipient_visibility"); stub(unread_ops, "process_visible"); @@ -192,7 +192,7 @@ run_test("basics", () => { [compose_closed_ui, "update_buttons_for_stream"], [compose_closed_ui, "update_reply_recipient_label"], [compose_actions, "on_narrow"], - [top_left_corner, "handle_narrow_activated"], + [left_sidebar_navigation_area, "handle_narrow_activated"], [stream_list, "handle_narrow_activated"], [typing_events, "render_notifications_for_narrow"], [message_view_header, "render_title_area"], diff --git a/web/tests/recent_topics.test.js b/web/tests/recent_topics.test.js index 250721d02f..649b228244 100644 --- a/web/tests/recent_topics.test.js +++ b/web/tests/recent_topics.test.js @@ -155,7 +155,7 @@ mock_esm("../src/sub_store", { }; }, }); -mock_esm("../src/top_left_corner", { +mock_esm("../src/left_sidebar_navigation_area", { narrow_to_recent_topics: noop, }); mock_esm("../src/unread", { diff --git a/web/tests/starred_messages.test.js b/web/tests/starred_messages.test.js index b8c65570c1..0dffb0e004 100644 --- a/web/tests/starred_messages.test.js +++ b/web/tests/starred_messages.test.js @@ -7,7 +7,7 @@ const {make_stub} = require("./lib/stub"); const {run_test} = require("./lib/test"); const {user_settings} = require("./lib/zpage_params"); -const top_left_corner = mock_esm("../src/top_left_corner", { +const left_sidebar_navigation_area = mock_esm("../src/left_sidebar_navigation_area", { update_starred_count() {}, }); const message_store = zrequire("message_store"); @@ -99,7 +99,7 @@ run_test("rerender_ui", () => { user_settings.starred_message_counts = true; with_overrides(({override}) => { const stub = make_stub(); - override(top_left_corner, "update_starred_count", stub.f); + override(left_sidebar_navigation_area, "update_starred_count", stub.f); starred_messages_ui.rerender_ui(); assert.equal(stub.num_calls, 1); const args = stub.get_args("count"); @@ -109,7 +109,7 @@ run_test("rerender_ui", () => { user_settings.starred_message_counts = false; with_overrides(({override}) => { const stub = make_stub(); - override(top_left_corner, "update_starred_count", stub.f); + override(left_sidebar_navigation_area, "update_starred_count", stub.f); starred_messages_ui.rerender_ui(); assert.equal(stub.num_calls, 1); const args = stub.get_args("count");