Skip to content
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

fix: prevent channel unread count reset to 0 when sending message and on new own or thread messages #1210

Merged
merged 3 commits into from
Feb 1, 2024

Conversation

MartinCupela
Copy link
Contributor

Description of the changes, What, Why and How?

A user's unread count for a channel is not reset on the back-end when:

  1. the user sends a new message
  2. a thread reply is received
  3. message.new event for own message is received

Therefore neither the client should reset the unread count to 0. Keeping the logic that resets the count to 0 in the above cases would mean that if I channel is marked unread and one of the above actions happen (we receive a thread reply), then the channel unread count would locally be reset to 0, but on the BE it would be kept non-zero.

Copy link
Contributor

github-actions bot commented Jan 16, 2024

Size Change: +223 B (0%)

Total Size: 332 kB

Filename Size Change
dist/browser.es.js 71.6 kB +58 B (0%)
dist/browser.full-bundle.min.js 44.1 kB -7 B (0%)
dist/browser.js 72.5 kB +56 B (0%)
dist/index.es.js 71.6 kB +59 B (0%)
dist/index.js 72.5 kB +57 B (0%)

compressed-size-action

Copy link
Contributor

@szuperaz szuperaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested with the Angular SDK - everything is ok there. However, I don't think the old behavior caused any issues - probably because the SDK does a lot of markRead calls which will reset the unread count on the backend as well. Do I understand it correctly that these problems surfaced in connection of the mark unread feature?

@MartinCupela
Copy link
Contributor Author

I've tested with the Angular SDK - everything is ok there. However, I don't think the old behavior caused any issues - probably because the SDK does a lot of markRead calls which will reset the unread count on the backend as well. Do I understand it correctly that these problems surfaced in connection of the mark unread feature?

Yes @szuperaz that is correct. Imagine you mark some messages unread and you want to quickly send a message to that given channel. A side effect would be, that you see 0 unread messages, but the BE would keep unread count non-zero.

@MartinCupela MartinCupela merged commit 9cedf6f into master Feb 1, 2024
5 of 6 checks passed
@MartinCupela MartinCupela deleted the fix/prevent-unread-count-reset branch February 1, 2024 15:07
@github-actions github-actions bot mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants