Skip to content

Commit

Permalink
utils: Display muted messages in all streams except 'All messages'.
Browse files Browse the repository at this point in the history
We avoid creating MessageBox if the current narrow is 'All messages'.
These messages are however visible in their respective streams.

Tests added.

Fixes #272.
  • Loading branch information
sumanthvrao authored and neiljp committed Mar 4, 2019
1 parent ef85b54 commit 1fae27c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/ui/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ def test_is_muted(mocker, msg, narrow, muted_streams, muted_topics, muted):
[1],
None,
True,
1,
),
(
# Don't show in 'All messages'
[],
[1],
None,
True,
0,
)
])
Expand Down
3 changes: 2 additions & 1 deletion zulipterminal/ui_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def create_msg_box_list(model: Any, messages: Union[None, Iterable[Any]]=None,
# Remove messages of muted topics / streams.
if is_muted(msg, model):
muted_msgs += 1
continue
if model.narrow == []: # Don't show in 'All messages'.
continue

msg_flag = 'unread' # type: Union[str, None]
flags = msg.get('flags')
Expand Down

0 comments on commit 1fae27c

Please sign in to comment.