zulip-terminal
zulip-terminal copied to clipboard
Last 30 messages being muted causes crash when starting up ZT
Steps to repro:
- Mark Stream #Denmark to be muted (Web-App) in User 1 (Eg: Iago).
- In User 2 (Eg: Hamlet), send 30 odd (around 40 to be on safe side) messages to stream #Denmark.
- Open user Iago from ZT causing it to crash.
Complete Traceback:
ERROR:root:Can't set focus, ListBox is empty
Traceback (most recent call last):
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/cli/run.py", line 238, in main
autohide_setting).main()
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/core.py", line 38, in __init__
self.view = View(self)
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/ui.py", line 39, in __init__
super(View, self).__init__(self.main_window())
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/ui.py", line 84, in main_window
self.center_panel = self.message_view()
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/ui.py", line 46, in message_view
self.search_box)
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/ui_tools/views.py", line 284, in __init__
msg_list = MessageView(model)
File "/home/sumanthvrao/Git_Hub/zulip-terminal/zulipterminal/ui_tools/views.py", line 34, in __init__
self.set_focus(self.focus_msg)
File "/home/sumanthvrao/.local/share/virtualenvs/zulip-terminal-sRIAC_7x/lib/python3.6/site-packages/urwid/listbox.py", line 578, in set_focus
raise IndexError("Can't set focus, ListBox is empty")
IndexError: Can't set focus, ListBox is empty
NOTE: Discussed in #zulip-terminal>Last 30 muted messages
Reason why there is a crash: In the default all-messages view, ZT loads last 30 messages, but doesn't display muted messages. All of them being muted results in no messages being in focus.
Preferred approach: If muted messages are found then an equal number of messages are downloaded. (This specific algorithm may not work if all the streams are muted.)
@zulipbot add "bug" "help wanted"
It's worth mentioning that the webapp fetches many more than 30 messages to prepare the "all messages" view -- more like 1200, and uses that data to locally render various narrows before the server responds. While you may want to fix the original bug here, we may want to work in the direction of that approach (keeping in mind it's kinda a lot of work to do the full local rendering thing).
@zulipbot add "further discussion required"
@zulipbot claim
Hello @sumanthvrao, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 14 days.
You can reclaim this issue or claim any other issue by commenting @zulipbot claim
on that issue.
Thanks for your contributions, and hope to see you again soon!
@zulipbot claim
ERROR: You have already claimed this issue.
@zulipbot claim
Hello @sumanthvrao, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 14 days.
You can reclaim this issue or claim any other issue by commenting @zulipbot claim
on that issue.
Thanks for your contributions, and hope to see you again soon!