Skip to content

Commit 5d2b7e4

Browse files
committed
model/views: Add method to regularly update state markers in messages.
This commit: * introduces a method `update_msg_list_presence_markers` in middle column view class. It would be responsible for rendering the status markers (if present) in message list. * adds presence renderer function to the handler `start_presence_updates`. This way, the method `update_msg_list_presence_markers` is called every minute. The helper `update_msg_list_presence_markers` uses MessageBox method `update_msg_content_header` (added in previous commit) to update a message box (if required). Fixes zulip#896.
1 parent 732583f commit 5d2b7e4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

zulipterminal/model.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ def _start_presence_updates(self) -> None:
344344
self.initial_data["presences"] = response["presences"]
345345
self.users = self.get_all_users()
346346
if hasattr(self.controller, "view"):
347-
self.controller.view.users_view.update_user_list(
348-
user_list=self.users
349-
)
347+
view = self.controller.view
348+
view.users_view.update_user_list(user_list=self.users)
349+
view.middle_column.update_msg_list_presence_markers()
350350
time.sleep(60)
351351

352352
@asynch

zulipterminal/ui_tools/views.py

+7
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,13 @@ def get_next_unread_pm(self) -> Optional[int]:
547547
return pm
548548
return None
549549

550+
def update_msg_list_presence_markers(self) -> None:
551+
for msg_btn in self.body.log:
552+
# Update a message box content header if required.
553+
msg_btn.original_widget.update_msg_content_header()
554+
555+
self.controller.update_screen()
556+
550557
def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
551558
if is_command_key("GO_BACK", key):
552559
self.header.keypress(size, "esc")

0 commit comments

Comments
 (0)