-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: view: Fix Zulip crash during search. #977
Conversation
6aa7140
to
024e380
Compare
@zulipbot add "PR needs review" |
@neiljp Does this need any more changes? |
024e380
to
871e49c
Compare
871e49c
to
d8b789d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rohitth007 This has great potential 👍 There are quite a few moving parts here, so I'd like to see them split into independent parts where they are independent, to make it clearer what each part does. The search reset seems like a separate matter entirely to the changes necessary for the UI change which resolves the bug?
d8b789d
to
0731e14
Compare
@neiljp I have split the PR as suggested, I would like to know your views on some of the pending conversations so that they can be marked resolved. |
0731e14
to
ed4e13b
Compare
ed4e13b
to
691fe69
Compare
This is caused when ZT recieves an update event while searching and `set_count` assumes that all widgets in the log are Buttons since the log is updated while searching. This also means that message updates are only sent to a subset of streams, topics or users. Which also leads to missed updates and negative counts. Since, we only need to update the count variable in the button object this is solved by using `btn_list` instead of `log`. Solves part of zulip#642
This commit fixes a bug which causes Zulip to crash when searching Streams or Topics. This happens because when a search result is empty, log is empty and because an empty ListWalker returns None, it leads to a Type error when setting focus. This is fixed by making sure the user does not enter the empty list when the search result is empty. The boolean `empty_search` is used to achieve this. This commit also improves the UI/UX when search result is empty by displaying Text `Not Found` in place of the empty list. The user can then correct their search and `Not Found` disappears. A `search_error` attribute is introducted in the pallete which colors `Not Found` in `light red`. The `cross_mark` symbol - `STREAM_MARKER_INVALID` is also added for effect. Fixes zulip#923 Tests amended.
`STREAM_MARKER_INVALID` has been changed to `INVALID_MARKER` so that the cross symbol can be used in multiple places not necessarily related to streams. Eg: Search error indicator.
The name of the variable `topics_to_display` has been changed to `topic_display` to maintain consistency with `stream_display` and `user_display`.
The tests for `PanelSearchBox` introduced when fixing bug zulip#923 is split into two tests for better readability. Both cases `test_keypress_ENTER_focus_set` and `test_keypress_ENTER_focus_not_set` have to be checked carefully to avoid the bug.
`set_content('')` is used so that when a user presses `q` for a second search the caption becomes empty. This makes for a cleaner UI while searching by removing caption `Search Results` when typing. Tests amended.
b19d913
to
c45253c
Compare
@Rohitth007 Thanks for working on this! The bugfixes are great and the no-results UI is a definite improvement 👍 As per messages in the stream I've merged the unread counts bugfix and the crash bugfix/feature (plus symbol rename), with slight changes 🎉 I've left the other commits:
On that basis I'm going to close this now, and I'd suggest we build on that last commit in a new PR once we settle on a UI. |
Thanks for merging this 🎉 . Having a common Panel would be brilliant, it would be easier to maintain and create new ones, but care should be taken for the user list as you said as there is no the UserView and RightColumn are mixed up. I'll look into this 👍 |
This commit fixes a bug which causes Zulip to crash when searching
Streams or Topics. This happens because when a search result is
empty, log is empty and because an empty ListWalker returns None,
it leads to a Type error when setting focus.
Commit 1: Fixes update errors and unread count edge case.
set_count
assumes that all widgets in the log are Buttons sincethe log is updated while searching.
streams, topics or users. Which also leads to missed updates and
negative counts.
object this is solved by using
btn_list
instead oflog
.Solves part of #642
Commit 2: Fix Zulip crash during search.
Streams or Topics. This happens because when a search result is
empty, log is empty and because an empty ListWalker returns None,
it leads to a Type error when setting focus.
when the search result is empty. The boolean
empty_search
is usedto achieve this.
displaying Text
Not Found
in place of the empty list.The user can then correct their search and
Not Found
disappears.search_error
attribute is introducted in the pallete whichcolors
Not Found
inlight red
. Thecross_mark
symbol -STREAM_MARKER_INVALID
is also added for effect.Fixes #923
Commit 3: Name change for cross symbol for consistency.
STREAM_MARKER_INVALID
has been changed toINVALID_MARKER
sothat the cross symbol can be used in multiple places not necessarily
related to streams. Eg: Search error indicator.
Commit 4: Change name of
topics_to_display
for consistency.topics_to_display
has been changed totopic_display
to maintain consistency withstream_display
and
user_display
.Commit 5: Test split for better readability.
PanelSearchBox
introduced when fixing bug crash while using search #923 issplit into two tests for better readability.
test_keypress_ENTER_focus_set
andtest_keypress_ENTER_focus_not_set
have to be checked carefully toavoid the bug.
Commit 6: Erase caption when reattempting search.
set_content('')
is used so that when a user pressesq
for asecond search the caption becomes empty.
Search Results
when typing.