Skip to content

Commit a7d0d10

Browse files
committed
model: Add is_user_muted method.
Test added.
1 parent 6f1fcce commit a7d0d10

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/model/test_model.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4112,6 +4112,17 @@ def test_is_muted_topic(
41124112

41134113
assert return_value == is_muted
41144114

4115+
@pytest.mark.parametrize(
4116+
"user, is_muted",
4117+
[
4118+
case(1, False, id="unmuted_user"),
4119+
case(2, True, id="muted_user"),
4120+
],
4121+
)
4122+
def test_is_muted_user(self, user, is_muted, model):
4123+
model._muted_users = {2}
4124+
assert model.is_muted_user(user) == is_muted
4125+
41154126
@pytest.mark.parametrize(
41164127
"unread_topics, current_topic, next_unread_topic",
41174128
[

zulipterminal/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,9 @@ def is_muted_topic(self, stream_id: int, topic: str) -> bool:
957957
topic_to_search = (stream_name, topic)
958958
return topic_to_search in self._muted_topics
959959

960+
def is_muted_user(self, user_id: int) -> bool:
961+
return user_id in self._muted_users
962+
960963
def stream_topic_from_message_id(
961964
self, message_id: int
962965
) -> Optional[Tuple[int, str]]:

0 commit comments

Comments
 (0)