Skip to content

Commit 0f696ba

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

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-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_message_list_status_markers()
350350
time.sleep(60)
351351

352352
@asynch

zulipterminal/ui_tools/views.py

+8
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,14 @@ def get_next_unread_pm(self) -> Optional[int]:
552552
return pm
553553
return None
554554

555+
def update_message_list_status_markers(self) -> None:
556+
for msg_btn in self.body.log:
557+
message_box = msg_btn.original_widget
558+
559+
message_box.update_message_author_status()
560+
561+
self.controller.update_screen()
562+
555563
def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
556564
if is_command_key("GO_BACK", key):
557565
self.header.keypress(size, "esc")

0 commit comments

Comments
 (0)