Skip to content

Commit 776d795

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 33cc8e1 commit 776d795

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
@@ -349,6 +349,8 @@ def _start_presence_updates(self) -> None:
349349
if hasattr(self.controller, 'view'):
350350
self.controller.view.users_view.update_user_list(
351351
user_list=self.users)
352+
(self.controller.view.middle_column
353+
.update_msg_list_presence_markers())
352354
time.sleep(60)
353355

354356
@asynch

zulipterminal/ui_tools/views.py

+12
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,18 @@ def get_next_unread_pm(self) -> Optional[int]:
539539
return pm
540540
return None
541541

542+
def update_msg_list_presence_markers(self) -> None:
543+
for index in range(len(self.body.log)):
544+
msg_btn = self.body.log[index]
545+
546+
# Update a message box content header if required.
547+
msg_btn.original_widget.update_msg_content_header()
548+
549+
# Render the modified message list
550+
self.body.log[index] = msg_btn
551+
552+
self.controller.update_screen()
553+
542554
def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
543555
if is_command_key('GO_BACK', key):
544556
self.header.keypress(size, 'esc')

0 commit comments

Comments
 (0)