topic_list: Cut dependency on narrow.js.

This commit is contained in:
Tim Abbott 2023-05-31 15:29:38 -07:00
parent 8a2086fb4c
commit e2c9839c7b
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import render_more_topics_spinner from "../templates/more_topics_spinner.hbs";
import render_topic_list_item from "../templates/topic_list_item.hbs"; import render_topic_list_item from "../templates/topic_list_item.hbs";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
import * as narrow from "./narrow";
import * as popover_menus from "./popover_menus"; import * as popover_menus from "./popover_menus";
import * as scroll_util from "./scroll_util"; import * as scroll_util from "./scroll_util";
import * as stream_topic_history from "./stream_topic_history"; import * as stream_topic_history from "./stream_topic_history";
@ -306,7 +305,7 @@ export function get_topic_search_term() {
return $filter.val().trim(); return $filter.val().trim();
} }
export function initialize() { export function initialize({narrow_on_topic_click}) {
$("#stream_filters").on("click", ".topic-box", (e) => { $("#stream_filters").on("click", ".topic-box", (e) => {
if (e.metaKey || e.ctrlKey) { if (e.metaKey || e.ctrlKey) {
return; return;
@ -323,7 +322,7 @@ export function initialize() {
const sub = sub_store.get(stream_id); const sub = sub_store.get(stream_id);
const topic = $(e.target).parents("li").attr("data-topic-name"); const topic = $(e.target).parents("li").attr("data-topic-name");
narrow.activate( narrow_on_topic_click(
[ [
{operator: "stream", operand: sub.name}, {operator: "stream", operand: sub.name},
{operator: "topic", operand: topic}, {operator: "topic", operand: topic},

View File

@ -54,6 +54,7 @@ import * as message_scroll from "./message_scroll";
import * as message_view_header from "./message_view_header"; import * as message_view_header from "./message_view_header";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";
import * as muted_users from "./muted_users"; import * as muted_users from "./muted_users";
import * as narrow from "./narrow";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as navbar_alerts from "./navbar_alerts"; import * as navbar_alerts from "./navbar_alerts";
import * as navigate from "./navigate"; import * as navigate from "./navigate";
@ -702,7 +703,7 @@ export function initialize_everything() {
activity.initialize(); activity.initialize();
emoji_picker.initialize(); emoji_picker.initialize();
pm_list.initialize(); pm_list.initialize();
topic_list.initialize(); topic_list.initialize({narrow_on_topic_click: narrow.activate});
topic_zoom.initialize(); topic_zoom.initialize();
drafts.initialize(); drafts.initialize();
sent_messages.initialize(); sent_messages.initialize();