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

Add support for handling delete_message events. #1048

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zee-bit
Copy link
Member

@zee-bit zee-bit commented Jun 6, 2021

This adds a new event action in model that looks for delete_message events, potentially handling it by removing the message completely from the index, and then updates the rendered_view to handle the event dynamically without needing to switch narrows.

It also looks out for messages being unread before being deleted and updates the count appropriately. Similarly, for messages that were starred before being deleted, this updates the starred_count too.

Fixes one check-box of #993.

@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Jun 6, 2021
@zee-bit zee-bit force-pushed the delete-event-action branch from a9f5c99 to df95f4d Compare June 6, 2021 21:58
@zee-bit
Copy link
Member Author

zee-bit commented Jun 6, 2021

I'll add the tests tomorrow, after exploring for further corner-cases/bugs. :)

@zee-bit zee-bit force-pushed the delete-event-action branch from df95f4d to e7772c2 Compare June 6, 2021 22:08
@neiljp neiljp added the area: event handling How events from the server are responded to label Jun 6, 2021
@zee-bit zee-bit force-pushed the delete-event-action branch 3 times, most recently from 7ead3e1 to 68d97ba Compare June 8, 2021 14:48
@zulipbot zulipbot added size: XL [Automatic label added by zulipbot] and removed size: L [Automatic label added by zulipbot] labels Jun 8, 2021
zee-bit added 3 commits June 9, 2021 17:43
The _update_rendered_view function in model only supported updating
the UI and the corresponding message_box for message update events.
This commit adds the condition that checks for message deletion and
updates the UI to remove the message_box from the view.
This adds a new event action in model that looks for delete_message
events, potentially handling it by removing the message from the index,
and then updates the rendered_view to handle the event dynamically
without needing to switch narrows.

This commit currently doesn't handle updating index and UI related to
special narrows such as mentioned/starred, also doesn't handle updating
unread counts. It implements the bare minimum that is required for
handling such events.

Tests added.
This commit extends the previous commit that added rudimentary
support for handling delete_message event, and allows updating the
special narrows such as mentioned/starred that were depending on
message flags. This commit could be considered as a bugfix over the
previous one. It also handles updating the unread count if the
message was earlier unread before being deleted.

Tests added and amended.
Fixes one check-box in zulip#993.
@zee-bit zee-bit force-pushed the delete-event-action branch from 68d97ba to 482cabe Compare June 9, 2021 12:52
@zee-bit zee-bit changed the title [WIP] Add support for handling delete_message events. Add support for handling delete_message events. Jun 9, 2021
@zee-bit zee-bit added the PR needs review PR requires feedback to proceed label Jun 9, 2021
@zulipbot
Copy link
Member

Heads up @zee-bit, we just merged some commits that conflict with the changes you 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: event handling How events from the server are responded to has conflicts PR needs review PR requires feedback to proceed size: XL [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants