Skip to content

Commit

Permalink
helper: Refactor updating message count on muted streams.
Browse files Browse the repository at this point in the history
This simplifies how updating message count is handled
for muted stream vs non-muted streams.
  • Loading branch information
sumanthvrao authored and neiljp committed Mar 4, 2019
1 parent d4261d0 commit ef85b54
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions zulipterminal/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ def set_count(id_list: List[int], controller: Any, new_count: int) -> None:
add_to_counts = True
if msg_type == 'stream':
stream_id = messages[id]['stream_id']
for stream in streams:
if stream.stream_id in controller.model.muted_streams:
add_to_counts = False # if muted, don't add to eg. all_msg
break
if stream.stream_id == stream_id:
stream.update_count(stream.count + new_count)
break
if stream_id in controller.model.muted_streams:
add_to_counts = False # if muted, don't add to eg. all_msg
else:
for stream in streams:
if stream.stream_id == stream_id:
stream.update_count(stream.count + new_count)
break
else:
for user in users:
if user.user_id == user_id:
Expand Down

0 comments on commit ef85b54

Please sign in to comment.