Skip to content

Commit b844b8c

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 0b327d1 commit b844b8c

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
@@ -530,6 +530,18 @@ def get_next_unread_pm(self) -> Optional[int]:
530530
return pm
531531
return None
532532

533+
def update_msg_list_presence_markers(self) -> None:
534+
for index in range(len(self.body.log)):
535+
msg_btn = self.body.log[index]
536+
537+
# Update a message box content header if required.
538+
msg_btn.original_widget.update_msg_content_header()
539+
540+
# Render the modified message list
541+
self.body.log[index] = msg_btn
542+
543+
self.controller.update_screen()
544+
533545
def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
534546
if is_command_key('GO_BACK', key):
535547
self.header.keypress(size, 'esc')

0 commit comments

Comments
 (0)