-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
Handle edit message events triggering change in mention flags and unreads. #1068
Open
zee-bit
wants to merge
7
commits into
zulip:main
Choose a base branch
from
zee-bit:edit-event-mentions-unreads
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
553148c
to
b61a63c
Compare
b61a63c
to
7b853d5
Compare
c089fe2
to
14a97bc
Compare
This commit adds "unread_mentioned_msg_ids" field in model.index that copies and stores the message ids of unread mentioned messages obtained from the initial_data into this field. This field is currently not in sync with the server, but we only copy this data to index so that we are able to properly update it through events afterwards. Tests amended.
This commit rearranges the parameters of test__handle_update_message_event function such that all the expected_* variables are at the last and the order of parameters in fixture matches that of the function to maintain consistency with our general test functions.
This commit adds "flags" field in UpdateMessageEvent api_type, now that we are planning to handle flag changes in update_message_events. In particular, users can add/remove several flags such as mentioned/ wildcard_mentioned/has_alert_words from sent messages, and when they do, it triggers an update_message_event to the rest of the users, alongwith change in flags if there are any.
This commit updates the index, unread_count and flags if the message was indexed when an update_message event with change in mentioned flag(s) is detected. This currently doesn't handle updates when the event is for a non-indexed message. Changes in mentioned narrow after this event are not rendered at the same time but it updates the index so that a return to the mentioned messages narrow will do so. Tests amended.
This commit handles updating message flag for un-indexed messages on edit message events. If the message is not in index, we just need to update the unread_count. The count is updated after checking with initial data's unread mentioned msgs field which does not stay synced with the server, hence the logic is currently buggy.
14a97bc
to
e81fe1f
Compare
This commit updates the index.unread_mentioned_msg_ids field through update_message and update_message_flag events. The update_message event is responsible for adding/removing mentions from messages and we need to handle updating the above field appropriately. The update_message_flag event on the other hand can add the "read" flag to messages, so updating this field for these types of events also needs to be handled properly. Tests amended.
This commit expands some of the fixtures of present tests with the mentioned/wildcard_mentioned flags to make the tests more robust and generalized.
e81fe1f
to
3ccc071
Compare
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 |
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
bug
Something isn't working
has conflicts
PR needs review
PR requires feedback to proceed
size: XL
[Automatic label added by zulipbot]
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The commit structure is as follows:
helper/model: Copy unread mentioned messages from initial_data to Index.: Creates a new field in
index
asunread_mentioned_msg_ids
which stores the message ids of unread mentioned messages obtained from the initial_data.bugfix: api_types/model: Update mention flags on message edit events.: This commit updates the index, unread_count and flags if the message was indexed when an update message event with change in mention flag(s) is detected. If the message was not in
index
, we just update the unread_count. The count is updated after checking with initial data's unread mentioned msgs field which does not stay synced with the server, hence the logic is buggy.model: Update index's "unread_mentioned_msg_ids" field from events.: This commit updates the
index.unread_mentioned_msg_ids
field throughupdate_message
andupdate_message_flag
events.tests: model: Extend other tests to incorporate both mentioned flags.: This commit expands some of the fixtures of present tests with the mentioned/wildcard_mentioned flags to make the tests more robust and generalized.