zulip-terminal icon indicating copy to clipboard operation
zulip-terminal copied to clipboard

Last 30 messages being muted causes crash when starting up ZT

Open sumanthvrao opened this issue 5 years ago • 11 comments

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

sumanthvrao avatar Mar 11 '19 15:03 sumanthvrao

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.)

sumanthvrao avatar Mar 11 '19 15:03 sumanthvrao

@zulipbot add "bug" "help wanted"

sumanthvrao avatar Mar 11 '19 16:03 sumanthvrao

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).

timabbott avatar Mar 11 '19 20:03 timabbott

@zulipbot add "further discussion required"

sumanthvrao avatar Mar 22 '19 02:03 sumanthvrao

@zulipbot claim

sumanthvrao avatar Mar 23 '19 01:03 sumanthvrao

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 avatar May 02 '19 00:05 zulipbot

@zulipbot claim

sumanthvrao avatar May 02 '19 00:05 sumanthvrao

ERROR: You have already claimed this issue.

zulipbot avatar May 02 '19 00:05 zulipbot

@zulipbot claim

sumanthvrao avatar May 11 '19 01:05 sumanthvrao

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 avatar Jun 18 '19 15:06 zulipbot