App icon indicating copy to clipboard operation
App copied to clipboard

HIGH: [UX Reliability] [$250] Chat is not marked as read when receiving a message being in the chat

Open m-natarajan opened this issue 10 months ago • 30 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.62-3 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @iwiznia Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1711638025134599

Action Performed:

  1. Go to any chat
  2. Open another tab or not having the window on focus
  3. Receive a notification for a new message in the chat
  4. Click on the notification and land on the chat
  5. Chat should be marked since message is read
  6. Go to another chat
  7. Again open the chat where the message is received

Expected Result:

In step 4 or in step 6 LHN should be unbold as the message is read

Actual Result:

Still showing as unread, user has to click back to the chat as in step 7 to show as "read"

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [ ] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/38435837/cc01a991-50f0-4fee-b112-477bb33c3c4e

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018e5ebea78782ee33
  • Upwork Job ID: 1778874424236658688
  • Last Price Increase: 2024-04-26

m-natarajan avatar Apr 11 '24 20:04 m-natarajan

Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Apr 11 '24 20:04 melvin-bot[bot]

Yep, could repro, though low value

dylanexpensify avatar Apr 12 '24 19:04 dylanexpensify

Job added to Upwork: https://www.upwork.com/jobs/~018e5ebea78782ee33

melvin-bot[bot] avatar Apr 12 '24 19:04 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

melvin-bot[bot] avatar Apr 12 '24 19:04 melvin-bot[bot]

though low value

I disagree, this is happening to me every day, many times a day. It makes the app look broken as it makes you have to click out and back in to mark as read.

iwiznia avatar Apr 12 '24 20:04 iwiznia

What is the expected behaviour? Should we quickly mark it as read when the user switches to the tab? Then the user wouldn't be able to know that there are some new messages, and where the new messages start from. Maybe we can have some interval, like mark it as read after 4 seconds (just as an example).

ShridharGoel avatar Apr 13 '24 12:04 ShridharGoel

Doesn't show notifications for me like in the video, do I need to activate something? trying to replicate the issue. @dylanexpensify

giorgi17 avatar Apr 14 '24 16:04 giorgi17

📣 @giorgi17! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Apr 14 '24 16:04 melvin-bot[bot]

I disagree, this is happening to me every day, many times a day. It makes the app look broken as it makes you have to click out and back in to mark as read.

happy to move this higher then @iwiznia!

dylanexpensify avatar Apr 15 '24 09:04 dylanexpensify

Doesn't show notifications for me like in the video, do I need to activate something? trying to replicate the issue. @dylanexpensify

@giorgi17 ah make sure your preferences allow for notifications from New Expensify!

dylanexpensify avatar Apr 15 '24 09:04 dylanexpensify

What is the expected behaviour? Should we quickly mark it as read when the user switches to the tab? Then the user wouldn't be able to know that there are some new messages, and where the new messages start from. Maybe we can have some interval, like mark it as read after 4 seconds (just as an example).

@ShridharGoel simple - just if the user clicks on the notification and reads the chat, it's marked as read then and there (aka unbolds instantly when opening the chat).

dylanexpensify avatar Apr 15 '24 09:04 dylanexpensify

simple - just if the user clicks on the notification and reads the chat, it's marked as read then and there (aka unbolds instantly when opening the chat).

@dylanexpensify And what about the "New" marker that we show above the unread messages?

ShridharGoel avatar Apr 15 '24 09:04 ShridharGoel

@ShridharGoel that should disappear at the same rate it does for any new message! cc @Expensify/design not sure if we have a limit distinguished for this

dylanexpensify avatar Apr 15 '24 09:04 dylanexpensify

I would think the New marker would stay in the chat as long as you are looking at the chat. This way if you do scroll up and down in the chat, you at least have a marker that shows you where the new messages start. If you navigate away and come back, then the new marker would disappear. Is that what you are asking Dylan?

shawnborton avatar Apr 15 '24 11:04 shawnborton

Doesn't show notifications for me like in the video, do I need to activate something? trying to replicate the issue. @dylanexpensify

@giorgi17 ah make sure your preferences allow for notifications from New Expensify!

I did, but still couldn't see notifications, perhaps it's not reproducible on local. However, I've found similar issue, where receiving the message and opening It doesn't unbold the text, it's still seen as "unread". It only works after 1 minute or so. See the footage My diagnosis is that from frontend, the message creation time is sent correctly, but then the response has the time 1.5 minutes later, because of this, the logic is flawed. Read time is always 1.5 minute earlier if you quickly try to view the new message upon receiving it, you basically need to wait 2 minutes so you can then open the chat and it'll then pick that it's now read, so, for the first 2 minutes, this logic doesn't work. This is why I was trying to find the backend code, it's a huge project, could you tell me where I could see the backend code, or Is there one at all in this project. Maybe i could find the reason there for this time difference.

The same reason could be in the case of notification. Fixing this requires figuring out, why after sending the right message creation time, i receive the time from the database that is 1.5 minutes older.

You can see this difference in this pics: This is what Is sent from frontend - lastVisibleActionCreated . image This is what I got back: image About 1.5 minute difference.

This is the line where it's compared: image

lastReadTime is I believe created in frontend, but the lastVisibleActionCreated is received from backend, which is incorrect by almost 2 minutes, so if chat opened in that timeline, in the first 2 minutes, it won't "unbold" the name and it'll see it as unread.

giorgi17 avatar Apr 15 '24 12:04 giorgi17

@abdulrahuman5196, @dylanexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Apr 18 '24 18:04 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Apr 19 '24 16:04 melvin-bot[bot]

@abdulrahuman5196, @dylanexpensify Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Apr 22 '24 18:04 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Yes, my proposal is satisfactory - https://github.com/Expensify/App/issues/40152#issuecomment-2056672875

giorgi17 avatar Apr 22 '24 20:04 giorgi17

Checking now

abdulrahuman5196 avatar Apr 23 '24 12:04 abdulrahuman5196

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Yes, my proposal is satisfactory - #40152 (comment)

@giorgi17 Kindly propose your root cause and solution as per the https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md

abdulrahuman5196 avatar Apr 23 '24 12:04 abdulrahuman5196

@FitseTLT I think we fixed this sometime back right? Or is it different?

abdulrahuman5196 avatar Apr 23 '24 12:04 abdulrahuman5196

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Yes, my proposal is satisfactory - #40152 (comment)

@giorgi17 Kindly propose your root cause and solution as per the https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md

I did - here. What did I do incorrectly? My solution works, and I followed the correct structure for proposing solution.

giorgi17 avatar Apr 23 '24 12:04 giorgi17

@abdulrahuman5196 @dylanexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Apr 25 '24 18:04 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Apr 26 '24 16:04 melvin-bot[bot]

@abdulrahuman5196, @dylanexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Apr 26 '24 18:04 melvin-bot[bot]

I'm seeing something different than what giorgi is seeing. When following the steps to reproduce, when i console log the optimisticReport from src/libs/actions/Report.ts:477 , and compare it's lastVisibleActionCreatedTime to that from the lastVisibleActionCreatedTime value inside the addComment POST response body, i see a difference in the order of milliseconds (2024-04-27 18:27:57.093 from the response body and 2024-04-27 18:27:56.685 from the optimistic report object for example ).

One thing I've noticed is that components that are getting report data from the onyx store via withOnyx are rendering with stale data when landing on a report from a browser notification.

The components DO have a render where they are rendering with the most up to date lastReadTime, but then they rerender with the previous/stale lastReadTime.

You can see this when you view the lastReadTime for a report in local storage, and then compare it to a value for a report the withOnyx HOC is returning.

Just for an arbitrary example, in localStorage I happen to have 2024-04-27 18:28:05.186 for the report i'm testing, but when i inspect the props LHNOptionsList is getting with react devtools I see 2024-04-27 18:27:04.873 , which is the previous / stale value for lastReadTime.

This is the first expensify issue I have looked at and I don't know enough about onyx or the report flow to diagnose a root cause.

robert-westenberger avatar Apr 27 '24 18:04 robert-westenberger

📣 @robert-westenberger! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Apr 27 '24 18:04 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0121200855c9004c83

robert-westenberger avatar Apr 27 '24 18:04 robert-westenberger

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Apr 27 '24 18:04 melvin-bot[bot]