Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support muted users #1546

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/ui/test_ui_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,8 @@ def test_users_view(self, users, users_btn_len, editor_mode, status, mocker):
user_btn = mocker.patch(VIEWS + ".UserButton")
users_view = mocker.patch(VIEWS + ".UsersView")
right_col_view = RightColumnView(self.view)
mocker.patch("zulipterminal.model.Model.is_muted_user", return_value=False)
self.view.model.is_muted_user.return_value = False
Comment on lines +1081 to +1082
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like duplication, ie. is one doing what you might think?

if status != "inactive":
user_btn.assert_called_once_with(
user=self.view.users[0],
Expand Down
2 changes: 2 additions & 0 deletions zulipterminal/ui_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,8 @@ def users_view(self, users: Any = None) -> Any:

users_btn_list = list()
for user in users:
if self.view.model.is_muted_user(user["user_id"]):
continue
Comment on lines 728 to +730
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a reasonable location for this to get this working, though it seems like a high-level location to be checking through each user. It would be clearer to have a users-without-muted list available from the model, in future, but may need reworking for that.

status = user["status"]
# Only include `inactive` users in search result.
if status == "inactive" and not self.view.controller.is_in_editor_mode():
Expand Down
Loading