mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
topic_list: Clean up component API.
The theory here is that we should prefer to give component callbacks a simple interface relative to what happened in the component, rather than a simple implementation relative to what the parent context will do with that information. Components should be designed to support being embedded in many possible contexts, including unit tests and Storybook pages. We’re nowhere near that future but we might as well take steps in that direction. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
7ad3225ecc
commit
9d8c6f9186
@@ -99,6 +99,7 @@ import * as stream_edit_subscribers from "./stream_edit_subscribers";
|
||||
import * as stream_list from "./stream_list";
|
||||
import * as stream_list_sort from "./stream_list_sort";
|
||||
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";
|
||||
@@ -705,7 +706,18 @@ export function initialize_everything() {
|
||||
activity.initialize();
|
||||
emoji_picker.initialize();
|
||||
pm_list.initialize();
|
||||
topic_list.initialize({narrow_on_topic_click: narrow.activate});
|
||||
topic_list.initialize({
|
||||
on_topic_click(stream_id, topic) {
|
||||
const sub = sub_store.get(stream_id);
|
||||
narrow.activate(
|
||||
[
|
||||
{operator: "stream", operand: sub.name},
|
||||
{operator: "topic", operand: topic},
|
||||
],
|
||||
{trigger: "sidebar"},
|
||||
);
|
||||
},
|
||||
});
|
||||
topic_zoom.initialize();
|
||||
drafts.initialize();
|
||||
sent_messages.initialize();
|
||||
|
||||
Reference in New Issue
Block a user