stream_list: Rename confusing on_stream_click.

This commit is contained in:
Tim Abbott
2025-07-16 12:32:29 -07:00
parent 2294552080
commit 85835fae9b
3 changed files with 12 additions and 12 deletions

View File

@@ -850,10 +850,10 @@ export function initialize_stream_cursor(): void {
} }
export function initialize({ export function initialize({
on_stream_click, show_channel_feed,
update_inbox_channel_view, update_inbox_channel_view,
}: { }: {
on_stream_click: (stream_id: number, trigger: string) => void; show_channel_feed: (stream_id: number, trigger: string) => void;
update_inbox_channel_view: (channel_id: number) => void; update_inbox_channel_view: (channel_id: number) => void;
}): void { }): void {
update_inbox_channel_view_callback = update_inbox_channel_view; update_inbox_channel_view_callback = update_inbox_channel_view;
@@ -865,7 +865,7 @@ export function initialize({
update_subscribe_to_more_streams_link(); update_subscribe_to_more_streams_link();
initialize_stream_cursor(); initialize_stream_cursor();
initialize_tippy_tooltips(); initialize_tippy_tooltips();
set_event_handlers({on_stream_click}); set_event_handlers({show_channel_feed});
$("#stream_filters").on("click", ".show-more-topics", (e) => { $("#stream_filters").on("click", ".show-more-topics", (e) => {
zoom_in(); zoom_in();
@@ -923,9 +923,9 @@ export function initialize_tippy_tooltips(): void {
} }
export function set_event_handlers({ export function set_event_handlers({
on_stream_click, show_channel_feed,
}: { }: {
on_stream_click: (stream_id: number, trigger: string) => void; show_channel_feed: (stream_id: number, trigger: string) => void;
}): void { }): void {
$("#stream_filters").on("click", "li .subscription_block", (e) => { $("#stream_filters").on("click", "li .subscription_block", (e) => {
// Left sidebar channel links have an `href` so that the // Left sidebar channel links have an `href` so that the
@@ -972,7 +972,7 @@ export function set_event_handlers({
user_settings.web_channel_default_view === user_settings.web_channel_default_view ===
web_channel_default_view_values.channel_feed.code web_channel_default_view_values.channel_feed.code
) { ) {
on_stream_click(stream_id, "sidebar"); show_channel_feed(stream_id, "sidebar");
return; return;
} }
@@ -1012,7 +1012,7 @@ export function set_event_handlers({
); );
browser_history.go_to_location(destination_url); browser_history.go_to_location(destination_url);
} else { } else {
on_stream_click(stream_id, "sidebar"); show_channel_feed(stream_id, "sidebar");
return; return;
} }
}; };
@@ -1021,7 +1021,7 @@ export function set_event_handlers({
stream_topic_history_util.get_server_history(stream_id, () => { stream_topic_history_util.get_server_history(stream_id, () => {
topics = stream_topic_history.get_recent_topic_names(stream_id); topics = stream_topic_history.get_recent_topic_names(stream_id);
if (topics.length === 0) { if (topics.length === 0) {
on_stream_click(stream_id, "sidebar"); show_channel_feed(stream_id, "sidebar");
return; return;
} }
navigate_to_stream(); navigate_to_stream();
@@ -1096,7 +1096,7 @@ export function set_event_handlers({
} }
clear_and_hide_search(); clear_and_hide_search();
on_stream_click(stream_id, "sidebar enter key"); show_channel_feed(stream_id, "sidebar enter key");
} }
keydown_util.handle({ keydown_util.handle({

View File

@@ -561,7 +561,7 @@ export async function initialize_everything(state_data) {
left_sidebar_navigation_area.initialize(); left_sidebar_navigation_area.initialize();
stream_list_sort.initialize(); stream_list_sort.initialize();
stream_list.initialize({ stream_list.initialize({
on_stream_click(stream_id, trigger) { show_channel_feed(stream_id, trigger) {
const sub = sub_store.get(stream_id); const sub = sub_store.get(stream_id);
sidebar_ui.hide_all(); sidebar_ui.hide_all();
popovers.hide_all(); popovers.hide_all();

View File

@@ -527,14 +527,14 @@ test_ui("narrowing", ({mock_template}) => {
}); });
test_ui("focusout_user_filter", () => { test_ui("focusout_user_filter", () => {
stream_list.set_event_handlers({narrow_on_stream_click() {}}); stream_list.set_event_handlers({narrow_show_channel_feed() {}});
const e = {}; const e = {};
const click_handler = $(".stream-list-filter").get_on_handler("focusout"); const click_handler = $(".stream-list-filter").get_on_handler("focusout");
click_handler(e); click_handler(e);
}); });
test_ui("focus_user_filter", () => { test_ui("focus_user_filter", () => {
stream_list.set_event_handlers({narrow_on_stream_click() {}}); stream_list.set_event_handlers({narrow_show_channel_feed() {}});
initialize_stream_data(); initialize_stream_data();
stream_list.build_stream_list(); stream_list.build_stream_list();