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.

inbox: Prep data in JS instead of looping in hbs for stream container.

Shubham Padia4a893c7e8a41
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index 72bae3ad43c..bae11be0a8c 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -726,9 +726,12 @@ function insert_stream(stream_key: string): void {
const channel_folder_id = streams_dict.get(stream_key)!.folder_id;
const sorted_stream_keys = get_sorted_stream_keys(channel_folder_id);
const stream_index = sorted_stream_keys.indexOf(stream_key);
+ const stream_row = streams_dict.get(stream_key);
+ const stream_topics_data = topics_dict.get(stream_key)!;
const rendered_stream = render_inbox_stream_container({
- topics_dict: new Map([[stream_key, topics_dict.get(stream_key)]]),
- streams_dict,
+ stream_key,
+ stream_row,
+ topic_rows: [...stream_topics_data.values()],
});
const $channel_folder_header = $(`#${get_channel_folder_header_id(channel_folder_id)}`);
if (stream_index === 0) {
diff --git a/web/templates/inbox_view/inbox_stream_container.hbs b/web/templates/inbox_view/inbox_stream_container.hbs
index 61ccba414e9..7a6dee33612 100644
--- a/web/templates/inbox_view/inbox_stream_container.hbs
+++ b/web/templates/inbox_view/inbox_stream_container.hbs
@@ -1,14 +1,8 @@
-{{#each (map_entries topics_dict) as |key_value_list|}}
- <div id="{{key_value_list.[0]}}">
- {{#each (map_entries ../streams_dict) as |stream_key_value|}}
- {{#if (eq stream_key_value.[0] key_value_list.[0])}}
- {{> inbox_row stream_key_value.[1]}}
- {{/if}}
+<div id="{{stream_key}}">
+ {{> inbox_row stream_row}}
+ <div class="inbox-topic-container">
+ {{#each topic_rows}}
+ {{> inbox_row .}}
{{/each}}
- <div class="inbox-topic-container">
- {{#each (map_entries key_value_list.[1])}}
- {{>inbox_row this.[1]}}
- {{/each}}
- </div>
</div>
-{{/each}}
+</div>