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

[$500] Chat is showing bold in the LHN for the sender #36959

Closed
1 of 6 tasks
m-natarajan opened this issue Feb 20, 2024 · 17 comments
Closed
1 of 6 tasks

[$500] Chat is showing bold in the LHN for the sender #36959

m-natarajan opened this issue Feb 20, 2024 · 17 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Hourly KSv2 Reviewing Has a PR in review

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 20, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.42-4
Reproducible in staging?: needs reproduction
Reproducible in production?: needs reproduction
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: @mallenexpensify
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1708372588901089

Action Performed:

  1. Send a chat to user A
  2. Quickly navigated to another chat
  3. Observe chat with user A shows as bold and unread, even though you were the one who sent the last message.

If the above doesn't work, vary the speed in which you 'quickly navigate to another chat'? I've been able to reproduce it by very-quickly navigating sometimes, other times I've had to wait a second then navigate to another chat.

Expected Result:

Chat I sent to user A to NOT show as bold

Actual Result:

Chat is bold

Workaround:

unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

2024-02-20_13-06-17.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014244c90b04778060
  • Upwork Job ID: 1760124228381077504
  • Last Price Increase: 2024-02-21
@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Feb 20, 2024
Copy link

melvin-bot bot commented Feb 20, 2024

Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@mallenexpensify mallenexpensify added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Feb 21, 2024
@melvin-bot melvin-bot bot changed the title Chat is showing bold in the LHN for the sender [$500] Chat is showing bold in the LHN for the sender Feb 21, 2024
Copy link

melvin-bot bot commented Feb 21, 2024

Job added to Upwork: https://www.upwork.com/jobs/~014244c90b04778060

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 21, 2024
Copy link

melvin-bot bot commented Feb 21, 2024

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

@mallenexpensify
Copy link
Contributor

mallenexpensify commented Feb 21, 2024

Updated reproducible steps in OP, removed Needs Reproduction, added External label and adding to #vip-vsb.

@mananjadhav please prioritize this. Also, please try to reproduce and post your results.

Internal thread in #vip-vsb about too @isabelastisser

@jeremy-croff
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

We should never show the LHN as bold when the sender sends the message.

What is the root cause of that problem?

We do a naive timestamp comparison when we determine if something is unread. This has an underlying assumption that the sender has the current chat open, so the report's last read timestamp will match the last sent timestamp. This logic fails under the reproducible steps of this ticket.

What changes do you think we should make in order to solve the problem?

We can enhance the current isUnread logic to consider the sender of the last message so that it won't mark it as unread if the sender is me.

report.lastActorAccountID !== currentUserAccountID; are variables available in this scope.

What alternative solutions did you explore? (Optional)

@aneequeahmad
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Chat is showing bold in the LHN when the message is send by the user itself.

What is the root cause of that problem?

This line of code below is causing to set the isUnread of optionItem to true (can see the value of optionItem.isUnread set to true in console if we log)

!!optionItem.isUnread,

it causes to apply style styles.sidebarLinkTextBold here
const textUnreadStyle = optionItem?.isUnread && optionItem.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE ? [textStyle, styles.sidebarLinkTextBold] : [textStyle];

This change was introduced in commit c4de9b2

What changes do you think we should make in order to solve the problem?

!!optionItem.isUnread should be changed to optionItem.isUnread ?? false or !!optionItem.isUnread ?? undefined so that it isn't set to true by doing !!optionItem.isUnread

What alternative solutions did you explore? (Optional)

N/A

@dukenv0307
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

  • Chat is showing bold in the LHN for the sender

What is the root cause of that problem?

  • When we send the message, the report 's optimistic data is something like:
{
    "lastVisibleActionCreated": "2024-02-21 08:57:25.950",
    "lastReadTime": "2024-02-21 08:57:25.950"
}
  • Then, the BE will return the data like:
{
    "lastVisibleActionCreated": "2024-02-21 08:57:26.167",
}
  • So, that lead to the logic lastReadTime < lastVisibleActionCreated in here is true.

What changes do you think we should make in order to solve the problem?

  • When sending a message via AddComment API, we also need to send the lastVisibleActionCreated to the BE side, rather than creating a new lastVisibleActionCreated as I mentioned in the RCA section

What alternative solutions did you explore? (Optional)

  • We can also check if the newest message in sent by the current user or not, if true, early return the isUnread function. This solution is just workaround, in case we do not want to make a BE change

@trjExpensify trjExpensify added the DeployBlockerCash This issue or pull request should block deployment label Feb 21, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 21, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Feb 21, 2024

Triggered auto assignment to @Julesssss (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@trjExpensify
Copy link
Contributor

As far as I can tell from testing this isn't reproducible on production, so I'm adding the deploy blocker label.

  1. On staging, my own message causes the chat to be permanently unread when I quickly switch to another chat
  2. On prod, my own messages causes the name of the chat in the LHN to flash bold then get unbolded.

Thread in expensify-bugs here.

@Julesssss
Copy link
Contributor

I can reproduce it on production, so I'm removing the label. Also, this doesn't seem bad enough to hold the deployment on IMO. Just an annoyance with an easy workaround.

*to reproduce on mobile you have to minimize the app immediately after sending the message, instead of switching chats.

repro-prod.mov

@Julesssss Julesssss added Daily KSv2 and removed Hourly KSv2 DeployBlockerCash This issue or pull request should block deployment labels Feb 21, 2024
@trjExpensify
Copy link
Contributor

Ah nice, I tried a bunch and couldn't on web prod. Interesting a bunch of people have only started running into it in the last day judging by the multiple reports coming in as well. Anyway, agree if it's on prod it's not a deploy blocker. 👍

(FWIW, I don't agree with the sentiment that this type of bug in the core flow of day-to-day chat use wouldn't warrant being a blocker).

@Julesssss
Copy link
Contributor

Cool. Yeah, I swear I noticed this on Monday/Tuesday.

(FWIW, I don't agree with the sentiment that this type of bug in the core flow of day-to-day chat use wouldn't warrant being a blocker).

In my case switch chat quickly equaled less than 200ms, which is an outlier in my opinion. I had to use two hands in a prepared position to reproduce this. But perhaps the switch chat quickly value depends on account and device 🤷

@Julesssss
Copy link
Contributor

It looks like the real fix will be to return lastReadTime from the backend, so I'm making this one internal.

For internal employees. here's the potential solution

@Julesssss Julesssss removed External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Feb 21, 2024
@Julesssss
Copy link
Contributor

Okay, sorry but based on this message looks like I should be sticking with wave 5/6 work. Depending on other tasks I will be happy to pick this back up if we get it attached to a wave.

@Julesssss Julesssss removed their assignment Feb 22, 2024
@trjExpensify trjExpensify added Hourly KSv2 and removed Daily KSv2 labels Feb 22, 2024
@trjExpensify
Copy link
Contributor

This issue came up in #top-tier and we've escalated it to a fireroom.

@iwiznia iwiznia added the Reviewing Has a PR in review label Feb 22, 2024
@iwiznia
Copy link
Contributor

iwiznia commented Feb 22, 2024

Sending PR

@iwiznia iwiznia closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Hourly KSv2 Reviewing Has a PR in review
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

10 participants