js: Rename top_left_corner.js to left_sidebar_navigation_area.js.

This provides a much clearer and more consistent codebase name for
this part of the app.

Fixes part of #25902.
This commit is contained in:
Hardik Dharmani 2023-06-15 20:37:10 +05:30 committed by Tim Abbott
parent bd6184305a
commit cd24620c4a
14 changed files with 39 additions and 39 deletions

View File

@ -8,6 +8,7 @@ import * as drafts from "./drafts";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {$t_html} from "./i18n"; import {$t_html} from "./i18n";
import * as info_overlay from "./info_overlay"; 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_lists from "./message_lists";
import * as message_scroll from "./message_scroll"; import * as message_scroll from "./message_scroll";
import * as message_viewport from "./message_viewport"; 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 settings_toggle from "./settings_toggle";
import * as spectators from "./spectators"; import * as spectators from "./spectators";
import * as stream_settings_ui from "./stream_settings_ui"; 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 ui_report from "./ui_report";
import * as user_groups_settings_ui from "./user_groups_settings_ui"; import * as user_groups_settings_ui from "./user_groups_settings_ui";
import {user_settings} from "./user_settings"; 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 coming_from_recent_topics = maybe_hide_recent_topics();
const is_actively_scrolling = message_scroll.is_actively_scrolling(); const is_actively_scrolling = message_scroll.is_actively_scrolling();
narrow.deactivate(coming_from_recent_topics, 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 // We need to maybe scroll to the selected message
// once we have the proper viewport set up // once we have the proper viewport set up
setTimeout(navigate.maybe_scroll_to_selected, 0); setTimeout(navigate.maybe_scroll_to_selected, 0);

View File

@ -15,6 +15,7 @@ import {Filter} from "./filter";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import * as hashchange from "./hashchange"; import * as hashchange from "./hashchange";
import {$t} from "./i18n"; 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_edit from "./message_edit";
import * as message_feed_loading from "./message_feed_loading"; import * as message_feed_loading from "./message_feed_loading";
import * as message_feed_top_notices from "./message_feed_top_notices"; 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 spectators from "./spectators";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";
import * as stream_list from "./stream_list"; 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 topic_generator from "./topic_generator";
import * as typing_events from "./typing_events"; import * as typing_events from "./typing_events";
import * as unread from "./unread"; import * as unread from "./unread";
@ -542,7 +542,7 @@ export function activate(raw_operators, opts) {
const current_filter = narrow_state.filter(); 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); pm_list.handle_narrow_activated(current_filter);
stream_list.handle_narrow_activated(current_filter); stream_list.handle_narrow_activated(current_filter);
typing_events.render_notifications_for_narrow(); typing_events.render_notifications_for_narrow();
@ -991,7 +991,7 @@ export function to_compose_target() {
function handle_post_narrow_deactivate_processes() { function handle_post_narrow_deactivate_processes() {
compose_fade.update_message_list(); compose_fade.update_message_list();
top_left_corner.handle_narrow_deactivated(); left_sidebar_navigation_area.handle_narrow_deactivated();
pm_list.handle_narrow_deactivated(); pm_list.handle_narrow_deactivated();
stream_list.handle_narrow_deactivated(); stream_list.handle_narrow_deactivated();
compose_closed_ui.update_buttons_for_stream(); compose_closed_ui.update_buttons_for_stream();

View File

@ -11,6 +11,7 @@ import * as buddy_data from "./buddy_data";
import * as compose_closed_ui from "./compose_closed_ui"; import * as compose_closed_ui from "./compose_closed_ui";
import * as hash_util from "./hash_util"; import * as hash_util from "./hash_util";
import {$t} from "./i18n"; import {$t} from "./i18n";
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
import * as ListWidget from "./list_widget"; import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import {localstorage} from "./localstorage"; import {localstorage} from "./localstorage";
@ -41,7 +42,6 @@ import * as stream_data from "./stream_data";
import * as stream_list from "./stream_list"; import * as stream_list from "./stream_list";
import * as sub_store from "./sub_store"; import * as sub_store from "./sub_store";
import * as timerender from "./timerender"; import * as timerender from "./timerender";
import * as top_left_corner from "./top_left_corner";
import * as ui_util from "./ui_util"; import * as ui_util from "./ui_util";
import * as unread from "./unread"; import * as unread from "./unread";
import * as unread_ops from "./unread_ops"; import * as unread_ops from "./unread_ops";
@ -886,7 +886,7 @@ export function show() {
return; return;
} }
// Hide selected elements in the left sidebar. // 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(); stream_list.handle_narrow_deactivated();
// Hide "middle-column" which has html for rendering // Hide "middle-column" which has html for rendering

View File

@ -18,6 +18,7 @@ import * as emoji from "./emoji";
import * as emoji_picker from "./emoji_picker"; import * as emoji_picker from "./emoji_picker";
import * as giphy from "./giphy"; import * as giphy from "./giphy";
import * as hotspots from "./hotspots"; import * as hotspots from "./hotspots";
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
import * as linkifiers from "./linkifiers"; import * as linkifiers from "./linkifiers";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as message_events from "./message_events"; 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 stream_ui_updates from "./stream_ui_updates";
import * as sub_store from "./sub_store"; import * as sub_store from "./sub_store";
import * as submessage from "./submessage"; import * as submessage from "./submessage";
import * as top_left_corner from "./top_left_corner";
import * as typing_events from "./typing_events"; import * as typing_events from "./typing_events";
import * as unread_ops from "./unread_ops"; import * as unread_ops from "./unread_ops";
import * as unread_ui from "./unread_ui"; import * as unread_ui from "./unread_ui";
@ -475,7 +475,7 @@ export function dispatch_normal_event(event) {
case "add": { case "add": {
scheduled_messages.add_scheduled_messages(event.scheduled_messages); scheduled_messages.add_scheduled_messages(event.scheduled_messages);
scheduled_messages_overlay_ui.rerender(); scheduled_messages_overlay_ui.rerender();
top_left_corner.update_scheduled_messages_row(); left_sidebar_navigation_area.update_scheduled_messages_row();
break; break;
} }
case "remove": { case "remove": {
@ -483,13 +483,13 @@ export function dispatch_normal_event(event) {
scheduled_messages_overlay_ui.remove_scheduled_message_id( scheduled_messages_overlay_ui.remove_scheduled_message_id(
event.scheduled_message_id, event.scheduled_message_id,
); );
top_left_corner.update_scheduled_messages_row(); left_sidebar_navigation_area.update_scheduled_messages_row();
break; break;
} }
case "update": { case "update": {
scheduled_messages.update_scheduled_message(event.scheduled_message); scheduled_messages.update_scheduled_message(event.scheduled_message);
scheduled_messages_overlay_ui.rerender(); scheduled_messages_overlay_ui.rerender();
top_left_corner.update_scheduled_messages_row(); left_sidebar_navigation_area.update_scheduled_messages_row();
break; break;
} }
// No default // No default

View File

@ -3,13 +3,13 @@ import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_di
import * as confirm_dialog from "./confirm_dialog"; import * as confirm_dialog from "./confirm_dialog";
import {$t_html} from "./i18n"; 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_flags from "./message_flags";
import * as message_live_update from "./message_live_update"; import * as message_live_update from "./message_live_update";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as popover_menus from "./popover_menus"; import * as popover_menus from "./popover_menus";
import * as starred_messages from "./starred_messages"; import * as starred_messages from "./starred_messages";
import * as sub_store from "./sub_store"; import * as sub_store from "./sub_store";
import * as top_left_corner from "./top_left_corner";
import * as unread_ops from "./unread_ops"; import * as unread_ops from "./unread_ops";
import {user_settings} from "./user_settings"; import {user_settings} from "./user_settings";
@ -65,7 +65,7 @@ export function rerender_ui() {
popover_menus.get_topic_menu_popover()?.hide(); popover_menus.get_topic_menu_popover()?.hide();
popover_menus.get_starred_messages_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() { export function confirm_unstar_all_messages() {

View File

@ -42,6 +42,7 @@ import * as hotkey from "./hotkey";
import * as hotspots from "./hotspots"; import * as hotspots from "./hotspots";
import * as i18n from "./i18n"; import * as i18n from "./i18n";
import * as invite from "./invite"; import * as invite from "./invite";
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
import * as lightbox from "./lightbox"; import * as lightbox from "./lightbox";
import * as linkifiers from "./linkifiers"; import * as linkifiers from "./linkifiers";
import {localstorage} from "./localstorage"; 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 sub_store from "./sub_store";
import * as timerender from "./timerender"; import * as timerender from "./timerender";
import * as tippyjs from "./tippyjs"; import * as tippyjs from "./tippyjs";
import * as top_left_corner from "./top_left_corner";
import * as topic_list from "./topic_list"; import * as topic_list from "./topic_list";
import * as topic_zoom from "./topic_zoom"; import * as topic_zoom from "./topic_zoom";
import * as tutorial from "./tutorial"; import * as tutorial from "./tutorial";
@ -465,7 +465,7 @@ function initialize_unread_ui() {
activity.update_dom_with_unread_counts(counts), activity.update_dom_with_unread_counts(counts),
); );
unread_ui.register_update_unread_counts_hook((counts, skip_animations) => 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) => unread_ui.register_update_unread_counts_hook((counts) =>
stream_list.update_dom_with_unread_counts(counts), stream_list.update_dom_with_unread_counts(counts),
@ -680,7 +680,7 @@ export function initialize_everything() {
muted_users.initialize(muted_users_params); muted_users.initialize(muted_users_params);
stream_settings_ui.initialize(); stream_settings_ui.initialize();
user_group_settings_ui.initialize(); user_group_settings_ui.initialize();
top_left_corner.initialize(); left_sidebar_navigation_area.initialize();
stream_list.initialize({ stream_list.initialize({
on_stream_click(stream_id, trigger) { on_stream_click(stream_id, trigger) {
const sub = sub_store.get(stream_id); const sub = sub_store.get(stream_id);

View File

@ -71,7 +71,7 @@ const stream_ui_updates = mock_esm("../src/stream_ui_updates", {
update_announce_stream_option() {}, update_announce_stream_option() {},
}); });
const submessage = mock_esm("../src/submessage"); const submessage = mock_esm("../src/submessage");
mock_esm("../src/top_left_corner", { mock_esm("../src/left_sidebar_navigation_area", {
update_starred_count() {}, update_starred_count() {},
update_scheduled_messages_row() {}, update_scheduled_messages_row() {},
}); });

View File

@ -26,7 +26,7 @@ const settings = mock_esm("../src/settings");
const stream_settings_ui = mock_esm("../src/stream_settings_ui"); const stream_settings_ui = mock_esm("../src/stream_settings_ui");
const ui_util = mock_esm("../src/ui_util"); const ui_util = mock_esm("../src/ui_util");
const ui_report = mock_esm("../src/ui_report"); const ui_report = mock_esm("../src/ui_report");
mock_esm("../src/top_left_corner", { mock_esm("../src/left_sidebar_navigation_area", {
handle_narrow_deactivated() {}, handle_narrow_deactivated() {},
}); });
set_global("favicon", {}); set_global("favicon", {});

View File

@ -15,27 +15,27 @@ const scheduled_messages = mock_esm("../src/scheduled_messages");
scheduled_messages.get_count = () => 555; scheduled_messages.get_count = () => 555;
const {Filter} = zrequire("../src/filter"); 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", () => { run_test("narrowing", () => {
let filter = new Filter([{operator: "is", operand: "mentioned"}]); let filter = new Filter([{operator: "is", operand: "mentioned"}]);
// activating narrow // 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")); assert.ok($(".top_left_mentions").hasClass("active-filter"));
filter = new Filter([{operator: "is", operand: "starred"}]); 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")); assert.ok($(".top_left_starred_messages").hasClass("active-filter"));
filter = new Filter([{operator: "in", operand: "home"}]); 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")); assert.ok($(".top_left_all_messages").hasClass("active-filter"));
// deactivating narrow // 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_all_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_mentions").hasClass("active-filter")); assert.ok(!$(".top_left_mentions").hasClass("active-filter"));
@ -45,7 +45,7 @@ run_test("narrowing", () => {
set_global("setTimeout", (f) => { set_global("setTimeout", (f) => {
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_all_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_mentions").hasClass("active-filter")); assert.ok(!$(".top_left_mentions").hasClass("active-filter"));
assert.ok(!$(".top_left_starred_messages").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"), "<scheduled-count>"); make_elem($(".top_left_scheduled_messages"), "<scheduled-count>");
top_left_corner.update_dom_with_unread_counts(counts, false); left_sidebar_navigation_area.update_dom_with_unread_counts(counts, false);
top_left_corner.update_starred_count(444); left_sidebar_navigation_area.update_starred_count(444);
// Calls top_left_corner.update_scheduled_messages_row // Calls left_sidebar_navigation_area.update_scheduled_messages_row
top_left_corner.initialize(); left_sidebar_navigation_area.initialize();
assert.equal($("<mentioned-count>").text(), "222"); assert.equal($("<mentioned-count>").text(), "222");
assert.equal($("<home-count>").text(), "333"); assert.equal($("<home-count>").text(), "333");
@ -87,9 +87,9 @@ run_test("update_count_in_dom", () => {
counts.mentioned_message_count = 0; counts.mentioned_message_count = 0;
scheduled_messages.get_count = () => 0; scheduled_messages.get_count = () => 0;
top_left_corner.update_dom_with_unread_counts(counts, false); left_sidebar_navigation_area.update_dom_with_unread_counts(counts, false);
top_left_corner.update_starred_count(0); left_sidebar_navigation_area.update_starred_count(0);
top_left_corner.update_scheduled_messages_row(); left_sidebar_navigation_area.update_scheduled_messages_row();
assert.ok(!$("<mentioned-count>").visible()); assert.ok(!$("<mentioned-count>").visible());
assert.equal($("<mentioned-count>").text(), ""); assert.equal($("<mentioned-count>").text(), "");

View File

@ -16,7 +16,7 @@ mock_esm("../src/starred_messages", {
get_starred_msg_ids: () => [1, 2, 3, 4, 5], get_starred_msg_ids: () => [1, 2, 3, 4, 5],
remove() {}, remove() {},
}); });
mock_esm("../src/top_left_corner", { mock_esm("../src/left_sidebar_navigation_area", {
update_starred_count() {}, update_starred_count() {},
}); });

View File

@ -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 message_view_header = mock_esm("../src/message_view_header");
const notifications = mock_esm("../src/notifications"); const notifications = mock_esm("../src/notifications");
const stream_list = mock_esm("../src/stream_list"); 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 typing_events = mock_esm("../src/typing_events");
const unread_ops = mock_esm("../src/unread_ops"); const unread_ops = mock_esm("../src/unread_ops");
mock_esm("../src/recent_topics_util", { mock_esm("../src/recent_topics_util", {
@ -89,7 +89,7 @@ function test_helper() {
stub(notifications, "redraw_title"); stub(notifications, "redraw_title");
stub(stream_list, "handle_narrow_activated"); stub(stream_list, "handle_narrow_activated");
stub(message_view_header, "render_title_area"); 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(typing_events, "render_notifications_for_narrow");
stub(compose_recipient, "update_narrow_to_recipient_visibility"); stub(compose_recipient, "update_narrow_to_recipient_visibility");
stub(unread_ops, "process_visible"); stub(unread_ops, "process_visible");
@ -192,7 +192,7 @@ run_test("basics", () => {
[compose_closed_ui, "update_buttons_for_stream"], [compose_closed_ui, "update_buttons_for_stream"],
[compose_closed_ui, "update_reply_recipient_label"], [compose_closed_ui, "update_reply_recipient_label"],
[compose_actions, "on_narrow"], [compose_actions, "on_narrow"],
[top_left_corner, "handle_narrow_activated"], [left_sidebar_navigation_area, "handle_narrow_activated"],
[stream_list, "handle_narrow_activated"], [stream_list, "handle_narrow_activated"],
[typing_events, "render_notifications_for_narrow"], [typing_events, "render_notifications_for_narrow"],
[message_view_header, "render_title_area"], [message_view_header, "render_title_area"],

View File

@ -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, narrow_to_recent_topics: noop,
}); });
mock_esm("../src/unread", { mock_esm("../src/unread", {

View File

@ -7,7 +7,7 @@ const {make_stub} = require("./lib/stub");
const {run_test} = require("./lib/test"); const {run_test} = require("./lib/test");
const {user_settings} = require("./lib/zpage_params"); 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() {}, update_starred_count() {},
}); });
const message_store = zrequire("message_store"); const message_store = zrequire("message_store");
@ -99,7 +99,7 @@ run_test("rerender_ui", () => {
user_settings.starred_message_counts = true; user_settings.starred_message_counts = true;
with_overrides(({override}) => { with_overrides(({override}) => {
const stub = make_stub(); 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(); starred_messages_ui.rerender_ui();
assert.equal(stub.num_calls, 1); assert.equal(stub.num_calls, 1);
const args = stub.get_args("count"); const args = stub.get_args("count");
@ -109,7 +109,7 @@ run_test("rerender_ui", () => {
user_settings.starred_message_counts = false; user_settings.starred_message_counts = false;
with_overrides(({override}) => { with_overrides(({override}) => {
const stub = make_stub(); 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(); starred_messages_ui.rerender_ui();
assert.equal(stub.num_calls, 1); assert.equal(stub.num_calls, 1);
const args = stub.get_args("count"); const args = stub.get_args("count");