-
-
Notifications
You must be signed in to change notification settings - Fork 253
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 marking messages as read when tab inactive #1927
base: dev
Are you sure you want to change the base?
Fix: Prevent marking messages as read when tab inactive #1927
Conversation
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
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.
Looks good, should not make anything bad
Doesn't really work for me. I think you should use |
@greentore done! now |
I can't think of situation where |
When I said |
// Won't mark messages (or whatever in room) as read when tab inactive | ||
// or when browser is inactive (i.e. user interacts with some another app) | ||
if (document.hidden || !document.hasFocus()) return; | ||
|
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.
It seems like a wrong place to add such conditioning as this function intent is to mark room as read. A good place for require changes would be the code where markAsRead
is called (i guess in useEventArrive
hook in RoomTimeline.tsx
file)
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.
I guess you are right. Thanks for suggestions, I'll rewrite my code when I'll have enough time!
Description
When chat in Cinny is opened in browser, but tab isn't active, Cinny marks messages in chat as read anyway, which is really confusing for the conversation partner (for conversation partner it looks like you ignore them).
This PR adds check of
document.hidden
. When tab is inactive,markAsRead
will do nothing when calling it.Type of change
Checklist: