stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

Marking messages as read not updating correct messages

Open sandergo90 opened this issue 3 years ago • 5 comments

Hi,

We have a problem with marking messages as read in the following scenario:

  • Admin interface using the stream-react SDK is sending two messages in a specific channel (a reservation in our app) with two specific categories. This category is set as a property on the message.
  • Mobile application sees this two new messages on this reservations and shows a notification count
  • When viewing the reservation detail, we mark 1 specific message as read. We know that when marking a message as read for a user, that all messages before this one is also marked as read.

This was working correctly until recently our client started noticing that it isn't working anymore.

Let's say the first message is send at 2022-07-19T13:32:54.462994Z and the second at 2022-07-19T13:32:54.566933Z. (notice the milliseconds difference). The second message should not be marked as read yet, so using the SDK, we mark the first message as read.

According to the docs, the messages before this one should be marked read now. This is indeed so, but also the second message, which is a few milliseconds later, is marked as read.

Could you take a look at this please?

Is there maybe another possibility to have a function that can specifically mark 1 message as read?

Thanks! Sander

  • Package version: 4.2.0
  • react-native: 0.67.2
  • Device iOS 15

sandergo90 avatar Jul 19 '22 13:07 sandergo90

Hey @sandergo90 just to be clear, you can't mark specific message as read. It's the entire channel that you mark as read. I am not sure what you mean when you say "We mark first message as read", since there is no way to mark certain message as read:

The second message should not be marked as read yet, so using the SDK, we mark the first message as read.

vishalnarkhede avatar Aug 02 '22 06:08 vishalnarkhede

Hey team! Please add your planning poker estimate with ZenHub @khushal87 @madsroskar @santhoshvai @vishalnarkhede

vanGalilea avatar Aug 02 '22 07:08 vanGalilea

Hi @vishalnarkhede What's the purpose of adding a message id parameter to the markRead function?

sandergo90 avatar Aug 02 '22 07:08 sandergo90

Hey @sandergo90 pardon me for confusion. Honestly I was not aware of this parameter messageId in markRead function. So really sorry about that, I spoke too soon.

I will investigate the issue and get back to you :)

vishalnarkhede avatar Aug 04 '22 11:08 vishalnarkhede

Hi @vishalnarkhede, no problem, thanks for investigating!

sandergo90 avatar Aug 04 '22 11:08 sandergo90

Hey @sandergo90 I did investigate this issue and have managed to successfully reproduce it.

I discussed it with our backend team and unfortunately message_id param as part of markRead function got added ahead of time in our typescript before actually implementing it on backend. Due to some factors, this was deprioritised and never picked up.

I would like to thank you for bringing this up or pointing out this issue. We clearly dropped a ball here. But at this point we are not be able to prioritise this in near future. We will drop it from our typescript and add it back when it will be implemented on backend side.

vishalnarkhede avatar Nov 18 '22 09:11 vishalnarkhede