fix: Notifications for thread messages are sent even after thread has been read - #31181
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #31181 +/- ##
============================================
- Coverage 77.38% 48.87% -28.51%
============================================
Files 276 3270 +2994
Lines 8715 80304 +71589
Branches 1607 16378 +14771
============================================
+ Hits 6744 39248 +32504
- Misses 1565 36405 +34840
- Partials 406 4651 +4245
Flags with carried forward coverage won't be shown. Click here to find out more. |
🦋 Changeset detectedLatest commit: a5f7273 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
sampaiodiego
left a comment
There was a problem hiding this comment.
I think the actual solution should be calling await NotificationQueue.clearQueueByUserId(uid); from readThread function:
the way it works we just clear the whole queue if the user is active in the system.. we don't actually care of what is in the queue
Ohhh agreed 🤔 that's by the definition of how our notifications should work 😬 not checking "scope" |
…ocketChat/Rocket.Chat into fix/clear-notifications-thread
…nto fix/clear-notifications-thread
yes, exactly.. if the user has made any action within the application we just wipe out the notification queue.. the idea is that since the user is active using the application we don't need to bother him by sending push or email notifications. |
MarcosSpessatto
left a comment
There was a problem hiding this comment.
I think we must do the same here, don't we? https://github.com/RocketChat/Rocket.Chat/blob/develop/apps/meteor/ee/server/local-services/message-reads/service.ts#L11
Ideally we should unify everything in a single place, but we can do that in another PR.
As we discussed, this won't be needed since the MessageReads service is only used in the callbacks (after the notification queue has been cleared). Thanks for the review!
…/emailEmoji * 'develop' of github.com:RocketChat/Rocket.Chat: chore: `Field` normalization (#31182) refactor: `Conversations` Overview Analytics (#31217) fix: Notifications for thread messages are sent even after thread has been read (#31181) ci: remove carryforward from codecov (#31216) fix: Wrong sysmessage when resuming chat from on hold (#31205) fix: Gallery not working inside threads (#31213)
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Start a thread with two or more users, and keep it open for both of them while no new message is sent in the main room.
Send a thread message with user A, then read it with user B (by keeping the thread open or opening the thread after the message is sent).
Current behavior: a push notification is sent after some minutes;
Expected behavior: no push notifications should be sent since the messages have been read (the queue can be checked in the
rocketchat_notification_queuedb collection). Notifications should be cleared when usinggetThreadMessagesorreadThreadsmethods.Further comments
SUP-386