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.

unread: Return consistent data structure in unread_count_info_for_stream.

evykassirerd2cf9aaff298
diff --git a/web/src/unread.js b/web/src/unread.js
index caeac33aa28..f72f42afddd 100644
--- a/web/src/unread.js
+++ b/web/src/unread.js
@@ -310,7 +310,12 @@ class UnreadTopicCounter {
const per_stream_bucketer = this.bucketer.get(stream_id);
if (!per_stream_bucketer) {
- return 0;
+ return {
+ unmuted_count: 0,
+ muted_count: 0,
+ followed_count: 0,
+ stream_is_muted: false,
+ };
}
const sub = sub_store.get(stream_id);
diff --git a/web/tests/unread.test.js b/web/tests/unread.test.js
index d019e09ee5e..9013799e2e4 100644
--- a/web/tests/unread.test.js
+++ b/web/tests/unread.test.js
@@ -258,7 +258,12 @@ test("muting", () => {
// we still find the message id here (muting is ignored)
assert.deepEqual(unread.get_all_msg_ids(), [message.id]);
- assert.equal(unread.unread_count_info_for_stream(unknown_stream_id), 0);
+ assert.deepEqual(unread.unread_count_info_for_stream(unknown_stream_id), {
+ unmuted_count: 0,
+ muted_count: 0,
+ followed_count: 0,
+ stream_is_muted: false,
+ });
});
test("num_unread_for_topic", () => {