Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.58k stars 2.92k forks source link

[$250] LHN - After creating split expense and switching to another chat, LHN displays it as unread #52194

Open lanitochka17 opened 3 weeks ago

lanitochka17 commented 3 weeks ago

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: 9.0.59-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Y Email or phone of affected tester (no customers): applausetester+bm203@applause.expensifail.com Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Create a workspace and go to the workspace chat
  3. Split an expense
  4. Observe that half of the split expense appears below it
  5. Go to another chat

Expected Result:

The chat report in the LHN should not appear in bold, as the split expense has already been viewed

Actual Result:

The chat report in the LHN appears in bold, even though the split expense was seen

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/2fde62c4-6fb1-45e5-801c-f2c032a89c7f

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021856693414198783158
  • Upwork Job ID: 1856693414198783158
  • Last Price Increase: 2024-11-27
Issue OwnerCurrent Issue Owner: @rayane-djouah
melvin-bot[bot] commented 3 weeks ago

Triggered auto assignment to @JmillsExpensify (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] commented 2 weeks ago

@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...

JmillsExpensify commented 2 weeks ago

While this is not a common flow, we have lots of issues with reports you just created showing unread in the LHN, so I'm going to open this up to the community to see if we have any creative solutions.

melvin-bot[bot] commented 2 weeks ago

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

melvin-bot[bot] commented 2 weeks ago

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

melvin-bot[bot] commented 1 week ago

@JmillsExpensify, @rayane-djouah Eep! 4 days overdue now. Issues have feelings too...

rayane-djouah commented 1 week ago

Waiting on proposals

melvin-bot[bot] commented 1 week ago

📣 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] commented 1 week ago

@JmillsExpensify @rayane-djouah 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!

ugogiordano commented 1 week ago

Proposal

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

After creating a split expense and then switching to another chat, the chat in the LHN is displayed as unread.

What is the root cause of that problem?

The issue arises because the report is flagged as requiring attention from the user.

This is due to the requiresAttentionFromCurrentUser function returning true—indicating that the report contains a child expense still awaiting action from the current user.

https://github.com/Expensify/App/blob/e04d145b607f768b36fb90b57fe57f40b536813d/src/components/LHNOptionsList/OptionRowLHN.tsx#L118 https://github.com/Expensify/App/blob/e04d145b607f768b36fb90b57fe57f40b536813d/src/libs/ReportUtils.ts#L2822-L2824

Specifically, the getReasonAndReportActionThatRequiresAttention function returns a non-empty ReasonAndReportActionThatRequiresAttention object, which signals that there is an unresolved action (such as a pending expense) requiring the user's attention.

https://github.com/Expensify/App/blob/e04d145b607f768b36fb90b57fe57f40b536813d/src/libs/ReportUtils.ts#L2740-L2743

This happens because the report’s hasOutstandingChildRequest is true, meaning the report has a child expense that is still pending action from the user. As a result, the condition evaluates to true, triggering the attention-required status, which ultimately causes the report to appear as unread in the LHN.

https://github.com/Expensify/App/blob/e04d145b607f768b36fb90b57fe57f40b536813d/src/libs/ReportUtils.ts#L2782-L2788

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

To fix this, when the report has an hasOutstandingChildRequest, we can add a check to see if the isUnread flag is false, like in the following snippet:

    // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user
    if (optionOrReport.hasOutstandingChildRequest && !!('isUnread' in optionOrReport && optionOrReport.isUnread)) {
        return {
            reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION,
            reportAction: IOU.getIOUReportActionToApproveOrPay(optionOrReport, optionOrReport.reportID),
        };
    }

This ensures that the unread icon is not displayed if the user has already read the chat, even when there’s an outstanding expense awaiting action.

https://github.com/user-attachments/assets/32d7e002-c17b-4990-a381-70c975d95f4f

What alternative solutions did you explore? (Optional)

None

rayane-djouah commented 1 week ago

Reviewing

melvin-bot[bot] commented 3 days ago

@JmillsExpensify, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

rayane-djouah commented 3 days ago

Other GHs have been a priority; I'll work on the proposal review soon.

melvin-bot[bot] commented 2 days ago

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

mvtglobally commented 21 hours ago

Issue not reproducible during KI retests. (First week)

rayane-djouah commented 11 hours ago

I'm not able to reproduce the issue. @ugogiordano, can you still reproduce it?

https://github.com/user-attachments/assets/fa64e5b2-31fe-4853-b871-9b3d8ec11cbe

ugogiordano commented 2 hours ago

@rayane-djouah I can no longer see the bold text, but the green dot is still present, even in your video. As I understand it, both the bold text and the green dot should disappear once the user has read the chat.