Skip to content

Commit 62fc329

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 class method `update_msg_content_header` (added in previous commit) to update a message box (if required). Fixes zulip#896.
1 parent f4f9700 commit 62fc329

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

zulipterminal/model.py

+2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ def _start_presence_updates(self) -> None:
354354
if hasattr(self.controller, 'view'):
355355
self.controller.view.users_view.update_user_list(
356356
user_list=self.users)
357+
(self.controller.view.middle_column
358+
.update_msg_list_presence_markers())
357359
time.sleep(60)
358360

359361
@asynch

zulipterminal/ui_tools/views.py

+12
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,18 @@ def get_next_unread_pm(self) -> Optional[int]:
525525
return pm
526526
return None
527527

528+
def update_msg_list_presence_markers(self) -> None:
529+
for index in range(len(self.body.log)):
530+
msg_btn = self.body.log[index]
531+
532+
# Update a message box content header if required.
533+
msg_btn.original_widget.update_msg_content_header()
534+
535+
# Render the modified message list
536+
self.body.log[index] = msg_btn
537+
538+
self.controller.update_screen()
539+
528540
def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
529541
if is_command_key('GO_BACK', key):
530542
self.header.keypress(size, 'esc')

0 commit comments

Comments
 (0)