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
messages: Add missing conditions for shouldBeMuted
.
#3542
Conversation
Thanks @ishammahajan ! The comparison to that webapp function is quite helpful.
I think this bit is meant to correspond to "sent by the current user" -- is that right? That's not what
|
I believe this will never trigger. Take a look at the comment on Did you try reproducing #3472, and did this change actually fix it? If it did, there's something puzzling going on which I'll want to understand better. |
I went through it and as I understand it now, the usages of the function just filters the messages belonging to muted topics and narrows out of the final array of messages to display in the message list. I tried to look around to find how we send notifications and how we filter those notifications, but I couldn't locate the exact file. I tried: |
Looking through this again, I think I misunderstood what the quoted issue was really all about. I thought it was about the user not getting notifications about some messages which they should get. But now, going through the code which processes FCM messages, in sealed class FcmMessage {
companion object {
fun fromFcmData(data: Map<String, String>): FcmMessage =
when (val eventType = data["event"]) {
"message" -> MessageFcmMessage.fromFcmData(data)
"remove" -> RemoveFcmMessage.fromFcmData(data)
null -> throw FcmMessageParseException("missing event type")
else -> throw FcmMessageParseException("unknown event type: $eventType")
}
}
} It doesn't really process anything, just filters out the MessageFcmMessages which have What was actually talking about is what editing
It will stop showing the messages the current user sent in all narrows. Disastrous! |
So the actual wanted code was in unmuted_messages: function (messages) {
return _.reject(messages, function (message) {
return muting.is_topic_muted(message.stream_id, util.get_message_topic(message)) &&
!message.mentioned;
});
}, Which takes care of only one extra case, which is when the user is mentioned. I'll update the commit message and the post saying this. |
It turns out that we don't properly set the flag state for mentions either. On https://zulipchat.com/api/update-message-flags We store |
94c6a90
to
356a42d
Compare
@gnprice this should be ready for another round of review! |
Thanks @ishammahajan for these updates!
Yep, for notifications we rely on the server to identify which messages the user wants to get notified about.
Yep, I believe that's right 🙂
Good catch, thanks!
Hmm, do we? The syntax choice between I think in fact the answer to this puzzle is that we have not been looking at this flag in OK, I think part of the answer is that it does not work for messages that newly come in! The
Those I guess I'll file a separate issue shortly for that. Right, so: thanks for spotting that mismatch. 😄 |
In the code: 4a55e3a flags state: Fix type to match api.
51aec0ad4 messages: Add missing condition to
|
So if I understand correctly from the rest of the review and the new issue, this is happening: The new messages coming in are being correctly saved in the state (under the appropriate redux subtree -- the same as that being sent by the server), but they aren't correctly being read by the specific narrow (eg. Is that correct? |
Ah, about to do that. Thanks! (also made the tests flow strict)
Oh, sorry. Fixed! 🙂
Ah, I missed that. Fixing! :) |
d0ada40
to
59a7842
Compare
@gnprice this should be ready for another round now! :) |
As in the webapp, when we use the `mentioned` flag, we always mean `mentioned || wildcard_mentioned` -- see `static/js/message_store.js -> set_message_booleans` in `zulip/zulip`. This commit combines the flags `mentioned` and `wildcard_mentioned` such that if `wildcard_mentioned` flag is set, a corresponding entry will be added to `mentioned` state as well. Also added tests for the same.
This commit is a pure refactor, and changes nothing in terms of functionality of the tests. Two new functions are also introduced in `exampleData`.
Now, if a topic is muted, you will still be able to see messages in that topic if they mention you -- the current user. The webapp's code in `static/js/message_list_data.js` has similar code under `Filter.unmuted_messages` which does one more thing than the previous `shouldBeMuted` used to do; allow messages which mention the current user pass through the `Filter`. Also add a test for the same. Fixes zulip#3472.
59a7842
to
97aa0da
Compare
Thanks @ishammahajan ! 7fa8ef7 flags reducer: Combine
|
This PR has gotten stale, and I think when we fix the things it was fixing we'll do so in new PRs. Part of it is subsumed by #4807, just merged, and #4910, which I just sent. I've just filed #4911 for what the first commit here was aimed at doing, fixing up the wildcard-mentions situation. With that I think everything is covered either by merged changes or open issues, so closing this. |
Based on the WebApp there are three conditions to be added -
(based in
../zulip/static/js/notifications.js
underexports.message_is_notifiable)
This commit handles the first two.
The third can be handled at a later point of time, since (IIUC) we don't already handle that type of logic. At this point, this PR is made to fix 3472 (and conveniently another issue).
Fixes #3472.