Skip to content
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: starred messages: Update messages in starred narrow. #943

Closed
wants to merge 1 commit into from

Conversation

Abhirup-99
Copy link
Contributor

@Abhirup-99 Abhirup-99 commented Mar 6, 2021

The commit updates ZT behavior in starred message section to match the web app. The current behavior involves removing the message when the user moves out of the starred section.
Fixes #940 .

@zulipbot zulipbot added the size: S [Automatic label added by zulipbot] label Mar 6, 2021
zulipterminal/model.py Outdated Show resolved Hide resolved
@neiljp neiljp added the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Mar 6, 2021
@Abhirup-99
Copy link
Contributor Author

@zulipbot add "PR needs review"

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Mar 6, 2021
@Abhirup-99
Copy link
Contributor Author

Abhirup-99 commented Mar 6, 2021

@zulipbot remove "PR awaiting update"

@zulipbot
Copy link
Member

zulipbot commented Mar 6, 2021

ERROR: Label "PR awaiting feedback" does not exist and was thus not removed from this pull request.

@Abhirup-99
Copy link
Contributor Author

@zulipbot remove "PR awaiting update"

@zulipbot zulipbot removed the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Mar 6, 2021
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Abhirup-99 I just tested this manually and the removal appears to work but I think we need to handle addition too?

Have you adjusted the tests to just pass so far? It'd be useful to have test cases for events triggering these change(s).

It's quicker to merge if you can set the commit title to follow the style we have in the rest of our git log (also see the README)

Comment on lines +116 to +117
if top_message_id in ids_to_keep:
ids_to_keep.remove(top_message_id) # update this id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a separate bugfix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to fix a race round condition when inside the current starred narrow, we unstar and remove the first message from the top, but when loading older messages, we try to remove this message_id again which is technically not present in the set anymore throwing errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: I tested again without the if block, and found the error.
Steps to check it out:

  • Remove the if block.
  • Move to the topmost loaded message inside the starred_messages narrow. Ensure that new messages don't get loaded.
  • Unstar it.
  • Try moving up(loading older messages).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2021-03-08 17-52-13

zulipterminal/model.py Show resolved Hide resolved
@neiljp neiljp added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback and removed PR needs review PR requires feedback to proceed labels Mar 7, 2021
@Abhirup-99 Abhirup-99 force-pushed the fix_bug_starred branch 3 times, most recently from e9930ad to 55df59e Compare March 8, 2021 19:39
@Abhirup-99
Copy link
Contributor Author

@zulipbot add "PR needs review".

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Mar 8, 2021
@Abhirup-99
Copy link
Contributor Author

@zulipbot remove "PR awaiting update"

@zulipbot zulipbot removed the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Mar 8, 2021
* Handle starred message addition and removal
events.
* Fix race around condition to handle removal of
last loaded message in the starred narrow without
exceptions.
Tests updated.
Fixes zulip#940.
@Abhirup-99
Copy link
Contributor Author

@neiljp please take a look when you are free. I have updated the commit message to make it more descriptive with all the individual changes I have done in this pr. Thanks :).

@Abhirup-99 Abhirup-99 changed the title starred messages: Remove message when moving out of starred section. bugfix: starred messages: Update messages in starred narrow. Mar 10, 2021
@zulipbot
Copy link
Member

Heads up @Abhirup-99, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

@neiljp
Copy link
Collaborator

neiljp commented Mar 15, 2021

@Abhirup-99 Thanks for working on this, this is a great bugfix to have 👍 As per my message in the stream, I've merged this manually with a few reformatting changes only 🎉 I excluded the view change for now since I think we should address this separately.

@neiljp neiljp closed this Mar 15, 2021
@neiljp neiljp added this to the Next Release milestone Mar 15, 2021
@neiljp neiljp added the bug Something isn't working label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has conflicts PR needs review PR requires feedback to proceed size: S [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove unstarred messages from starred messages narrow
3 participants