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

Improve "New messages" indicator behavior #104

Open
nesium opened this issue Jun 4, 2024 · 0 comments
Open

Improve "New messages" indicator behavior #104

nesium opened this issue Jun 4, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@nesium
Copy link
Contributor

nesium commented Jun 4, 2024

Hey Valerian. I’ve tried to send a MessagesUpdated event when the last read message changes after calling markAsRead(). This way the “New messages” indicator will disappear immediately if a new message comes in. However…

  • When selecting a room, the “New messages” indicator will also disappear (almost) immediately
  • If the indicator is above the visible area, you won’t be able to see it, since it disappears too quickly

I also don’t think that the indicator should disappear when you’ve selected a room and receive a new message, since that event is outside of your control. You might be scrolling back to catch up with the conversation and suddenly the marker goes away.

I would suggest to insert the “New messages” indicator when a room is selected. Then only remove it if…

  • The user sends a message from the selected room (possibly - imagine a "I'm back, now reading back old messages" message)
  • The user selects another room and comes back - unless there were new messages received in the meantime

As such I would suggest the following:

  • The core does not send a MessagesUpdated event when the lastRead message changes
  • The frontend continues to call markAsRead() after selecting a room, after receiving a message while the room is selected and (new) after sending a message if the room is selected (Update: Not needed anymore, since sent messages should always be displayed as read)
  • The frontend will remove the “New messages” indicator by setting the isLastRead of the last read message to false and setting it to true for the last message in the room when the user navigates away. If a MessagesAppended event is fired while a room is not selected the "New messages" indicator should be shown again above the first appended message when the user navigates back to the room - this could be done by checking if the last message in the room has the isLastRead flag set.

Edit: As discussed, messages from the current user should always be marked as read. This means that when inserting the unread indicator after the last read message, you need to check for any subsequent messages from the same user. If such messages exist, the unread indicator should be placed after these consecutive messages.

@valeriansaliou valeriansaliou self-assigned this Jun 5, 2024
@valeriansaliou valeriansaliou added the enhancement New feature or request label Jun 5, 2024
nesium added a commit to prose-im/prose-core-client that referenced this issue Jun 11, 2024
nesium added a commit to prose-im/prose-core-client that referenced this issue Jun 11, 2024
nesium added a commit to prose-im/prose-core-client that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants