Skip to content

Commit 3015e31

Browse files
committed
bugfix: helper: Avoid updating unread count for unsubscribed streams.
Unread count data from the server may include that for unsubscribed streams, which currently are not stored in Model.stream_dict. In the webapp (zulip/zulip repo), stream data includes unsubscribed and 'never_subscribed' streams (see populate_subscriptions in stream_data.js), so this issue does not arise. This has been an increased or particular issue recently due to addition of support for moving messages between streams. Fixes #694.
1 parent 3b0e029 commit 3015e31

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

zulipterminal/helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ def classify_unread_counts(model: Any) -> UnreadCounts:
439439
for stream in unread_msg_counts['streams']:
440440
count = len(stream['unread_message_ids'])
441441
stream_id = stream['stream_id']
442+
# unsubscribed streams may be in unreads, but not in stream_dict
443+
if stream_id not in model.stream_dict:
444+
continue
442445
if [model.stream_dict[stream_id]['name'],
443446
stream['topic']] in model.muted_topics:
444447
continue

0 commit comments

Comments
 (0)