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.

ui_init: Don't add `with` operator if topic has no messages.

Aman Agrawalffeb027b4ce3
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index a29d2eb8cdf..91a1b9c2ebc 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -668,16 +668,16 @@ export function initialize_everything(state_data) {
topic,
);
- assert(latest_msg_id !== undefined);
+ const narrow = [
+ {operator: "channel", operand: sub.stream_id.toString()},
+ {operator: "topic", operand: topic},
+ ];
- message_view.show(
- [
- {operator: "channel", operand: sub.stream_id.toString()},
- {operator: "topic", operand: topic},
- {operator: "with", operand: latest_msg_id},
- ],
- {trigger: "sidebar"},
- );
+ if (latest_msg_id !== undefined) {
+ narrow.push({operator: "with", operand: latest_msg_id});
+ }
+
+ message_view.show(narrow, {trigger: "sidebar"});
},
});
drafts.initialize_ui();