fix: align unread counting on muted channel #1265
Merged
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.
Description of the changes, What, Why and How?
Few weeks ago we received a GH issue where integrator mentions, that muting a channel with unread count
> 0
will reset unread count to zero - while that is not the case, the issue they described further still stands and that is when the state gets actually reset (upon unmuting said channel) and the page is reloaded (re-query the channels), the unread count is back where it was prior to muting/unmuting.This PR removes condition from unread counting function and removes state resetting in the
notification.channel_mutes_updated
handler. That way when the channel is unmuted the unread count represents actual value which would match the one received from the channel when re-queried.Circle back once applicable:
Adjust unread count behavior for muted channels - whenever muted channel receives a new message, the unread count state should increment. Currently this is not the case and re-querying after unmuting will result in new messages not being counted as unread.
To test:
/read
is not called)Expected count of unread messages for user B on channel C: 2
Actual unread count: 1
Handlers should account for this behaviour during runtime as well and should increase unread count; meaning
_countMessageAsUnread
should be adjusted as well.Closes: GetStream/stream-chat-react#2306
TODO