-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
message-editing: Update unread count when message is deleted in stream. #8415
Conversation
Hello @zulip/ members, this pull request was labeled with the **** labels, so you may want to check it out! |
354e83f
to
9fd451c
Compare
static/js/server_events_dispatch.js
Outdated
@@ -356,6 +356,8 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) { | |||
|
|||
case 'delete_message': | |||
var msg_id = event.message_id; | |||
var message = message_store.get(msg_id); | |||
unread_ops.mark_message_as_read(message); |
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.
Does this do the right thing in the case that the message had already been read? (I can imagine trying to double-mark something as read throwing an exception).
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.
Yes, sorry should have mentioned in the PR itself. mark_messages_as_read
passes the message list to unread.get_unread_messages
, which returns all the unread messages out of the given list. So double marking something as read would not occur
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.
Cool. I''ll merge a quick PR adding a comment to that effect, just to make things more readable.
I posted one comment; it also looks like the node tests are failing. |
9fd451c
to
269cb38
Compare
@shubham-padia you can use |
269cb38
to
b57eccb
Compare
@timabbott The tests have been fixed |
Nice! Merged after tweaking the commit message to better match our style, thanks @shubham-padia! You should read I left #8411 open because I bet there's still an issue with it appearing in the |
fixes zulip#8411 Unread counts in the left sidebar were not updated immediately on message delete.
fixes #8411 first issue
Testing instructions:
Send multiple messages to a stream, while the other user is offline. Note the unread count on the second user's sidebar. Start deleting those messages one by one. Note that the unread count is decreasing with the deletion.