Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

topic_list: Rename parent to stream_li for clarity.

Evy Kassirer2398b0f3517a
diff --git a/web/src/topic_list.ts b/web/src/topic_list.ts
index 3ebb6e590de..5b078877840 100644
--- a/web/src/topic_list.ts
+++ b/web/src/topic_list.ts
@@ -87,13 +87,13 @@ export function zoom_out(): void {
const stream_id = stream_ids[0];
const widget = active_widgets.get(stream_id);
assert(widget !== undefined);
- const parent_widget = widget.get_parent();
+ const $stream_li = widget.get_stream_li();
// Reset the resolved topic filter since we moved away
// from the view.
topic_filter_pill_widget?.clear(true);
- rebuild_left_sidebar(parent_widget, stream_id);
+ rebuild_left_sidebar($stream_li, stream_id);
}
type ListInfoNodeOptions =
@@ -266,16 +266,16 @@ export function is_full_topic_history_available(
export class TopicListWidget {
topic_list_class_name = "topic-list";
prior_dom: vdom.Tag<ListInfoNodeOptions> | undefined = undefined;
- $parent_elem: JQuery;
+ $stream_li: JQuery;
my_stream_id: number;
filter_topics: (topic_names: string[]) => string[];
constructor(
- $parent_elem: JQuery,
+ $stream_li: JQuery,
my_stream_id: number,
filter_topics: (topic_names: string[]) => string[],
) {
- this.$parent_elem = $parent_elem;
+ this.$stream_li = $stream_li;
this.my_stream_id = my_stream_id;
this.filter_topics = filter_topics;
}
@@ -334,8 +334,8 @@ export class TopicListWidget {
return dom;
}
- get_parent(): JQuery {
- return this.$parent_elem;
+ get_stream_li(): JQuery {
+ return this.$stream_li;
}
get_stream_id(): number {
@@ -343,7 +343,7 @@ export class TopicListWidget {
}
remove(): void {
- this.$parent_elem.find(`.${this.topic_list_class_name}`).remove();
+ this.$stream_li.find(`.${this.topic_list_class_name}`).remove();
this.prior_dom = undefined;
}
@@ -356,10 +356,10 @@ export class TopicListWidget {
const replace_content = (html: string): void => {
this.remove();
- this.$parent_elem.append($(html));
+ this.$stream_li.append($(html));
};
- const find = (): JQuery => this.$parent_elem.find(`.${this.topic_list_class_name}`);
+ const find = (): JQuery => this.$stream_li.find(`.${this.topic_list_class_name}`);
vdom.update(replace_content, find, new_dom, this.prior_dom);
@@ -367,7 +367,7 @@ export class TopicListWidget {
}
is_empty(): boolean {
- const $topic_list = this.$parent_elem.find(`.${this.topic_list_class_name}`);
+ const $topic_list = this.$stream_li.find(`.${this.topic_list_class_name}`);
return !$topic_list.hasClass("topic-list-has-topics");
}
}
@@ -382,8 +382,8 @@ function filter_topics_left_sidebar(topic_names: string[]): string[] {
}
export class LeftSidebarTopicListWidget extends TopicListWidget {
- constructor($parent_elem: JQuery, my_stream_id: number) {
- super($parent_elem, my_stream_id, filter_topics_left_sidebar);
+ constructor($stream_li: JQuery, my_stream_id: number) {
+ super($stream_li, my_stream_id, filter_topics_left_sidebar);
}
override build(spinner = false): void {
@@ -426,7 +426,7 @@ export function get_stream_li(): JQuery | undefined {
return undefined;
}
- const $stream_li = widgets[0].get_parent();
+ const $stream_li = widgets[0].get_stream_li();
return $stream_li;
}