Skip to content

[Awaiting C+ payment confo] Fix issues with the LHN previews and report actions surrounding iou/expenseReports when owed and paid. #30042

Closed

Description

@trjExpensify

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: v1.3.87-7
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: @trjExpensify
Slack conversation: came from this issue.

Action Performed:

Create an iouReport

  1. Global Create > Request Money > $50 > choose a person > Confirm
  2. Land in the DM
  3. Look at the LHN row to observe the preview

Create an expenseReport

  1. Create a workspace if you need to
  2. Global Create > Request Money > $50 > choose the workspace > confirm
  3. Land in the workspace chat
  4. Look at the LHN row to observe the preview

Pay an iouReport

  1. Navigate to the iouReport view
  2. Click Pay elsewhere green button at the top right of the report

Pay an expenseReport

  1. Navigate to the expenseReport view
  2. Click Pay elsewhere green button at the top right of the report
  3. Observe the system message added to the expenseReport
  4. Observe the LHN preview

Expected Result:

When an iouReport or expenseReport is "owed" the logic is as follows:

The logic for the LHN row when someone is owed is as follows:

Title: [%displayName% || %workspaceName%] owes £21.96
Preview: %firstName%: requested %amount% for [%merchant% || %comment%]

I.e

IOU Report

Jeff Banks owes £21.96
Tom: requested £5.00 for Thursday Lunch

Expense Report

Duraflame owes £21.96
Tom: requested £5.00 for Home Depot

When an iouReport or expenseReport is "paid" the logic is as follows:

  1. The reportAction added to the iouReport/expenseReport comes from the reimburser who paid
  2. The iouReport/expenseReport LHN title updates to "%workspaceName% paid %reportTotal%"
  3. The iouReport/expenseReport LHN preview shows the sys message in (1) from the reimburser.
  4. The DM/workspace chat LHN preview shows (2).

I.e

Report Action in the expense/iouReport

%reimburser% 11:58am
paid $50.00 elsewhere

expenseReport LHN

Duraflame paid $50.00
Tom: paid $50.00 elsewhere

workspace chat LHN

Joe Bloggs || Duraflame
Duraflame paid $50.00

Actual Result:

The LHN preview is incorrect when someone owes:

image

The report action added to the iou/expenseReport is incorrect when someone pays the report:

image

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01653befc45305851e
  • Upwork Job ID: 1715173054584414208
  • Last Price Increase: 2023-10-20

Activity

  1. added
    InternalRequires API changes or must be handled by Expensify staff
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 20, 2023
  2. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    Current assignee @mountiny is eligible for the Engineering assigner, not assigning anyone new.

  3. melvin-bot commented on Oct 20, 2023

    @melvin-bot
  4. melvin-bot commented on Oct 20, 2023

    @melvin-bot

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

  5. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  6. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    Current assignee @mananjadhav is eligible for the Internal assigner, not assigning anyone new.

  7. koko57 commented on Oct 20, 2023

    @koko57
    Contributor

    Ready to work on this issue 😊

  8. 117 remaining items

  9. mountiny commented on Jan 11, 2024

    @mountiny
    Contributor

    I do think we can keep this at $500 given the time this took to review and the complexity of the PR. We have reverted and did another attempt so its not like we have paid someone else for a fix.

    @koko57 Lets create new issues for these. I believe you can create issues yourself, would you mind doing so and tagging me in them to apply the correct label.

    Just link to this PR and frame the issue as Problem/ Solution

  10. trjExpensify commented on Jan 11, 2024

    @trjExpensify
    ContributorAuthor

    Perfect, sounds good to me. So confirming the payment is $500 to @mananjadhav for the C+ review. Feel free to go ahead and request money!

  11. mountiny commented on Jan 11, 2024

    @mountiny
    Contributor

    @mananjadhav once requested note here and we can close, thanks!

  12. changed the title [-][HOLD for payment 2024-01-05] Fix issues with the LHN previews and report actions surrounding iou/expenseReports when owed and paid.[/-] [+][Awaiting C+ payment confo] Fix issues with the LHN previews and report actions surrounding iou/expenseReports when owed and paid.[/+] on Jan 12, 2024
  13. mananjadhav commented on Jan 12, 2024

    @mananjadhav
    Collaborator

    I've requested the payment on NewDot.

  14. trjExpensify commented on Jan 12, 2024

    @trjExpensify
    ContributorAuthor

    Closing!

  15. JmillsExpensify commented on Jan 14, 2024

    @JmillsExpensify
    Contributor

    $500 payment approved for @mananjadhav based on this comment.

  16. paultsimura commented on Jan 20, 2024

    @paultsimura
    Contributor

    Hey, just wanted to raise a little awareness: this PR likely caused a regression when an updated amount is not displayed in the LHN because of these lines:

    App/src/libs/ReportUtils.ts

    Lines 2254 to 2263 in 52adf77

    // if we have the amount in the originalMessage and lastActorID, we can use that to display the preview message for the latest request
    if (originalMessage?.amount !== undefined && lastActorID && !isPreviewMessageForParentChatReport) {
    const amount = originalMessage?.amount;
    const currency = originalMessage?.currency ?? report.currency ?? '';
    const amountToDisplay = CurrencyUtils.convertToDisplayString(Math.abs(amount), currency);
    // We only want to show the actor name in the preview if it's not the current user who took the action
    const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant(lastActorID, !isPreviewMessageForParentChatReport) : '';
    return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: amountToDisplay})}`;
    }

    Basically, that's because the originalMessage holds only the initial amount value, not modifiedAmount.

    image

    I haven't seen a GH for this, just noticed it while working on one of my PRs.
    cc: @mountiny @koko57

  17. mountiny commented on Jan 21, 2024

    @mountiny
    Contributor

    Pi believe this was raised internally but its true that the root cause is that the report action only has the original amount. So it might misbehave for smartscans specifically or when amount is edited

  18. koko57 commented on Jan 22, 2024

    @koko57
    Contributor

    @paultsimura thanks for pointing this out! @mountiny yes, the last action for this type of chat doesn't have the updated value - we only have CREATED and IOU actions for this type of report and later we don't have the MODIFIEDEXPENSE action. If we go to the details we have the MODIFIEDEXPENSE action, so the preview is displaying a proper amount.
    Screenshot 2024-01-22 at 10 44 29
    Screenshot 2024-01-22 at 10 45 15
    Screenshot 2024-01-22 at 10 37 05
    Screenshot 2024-01-22 at 10 37 22

  19. mountiny commented on Jan 22, 2024

    @mountiny
    Contributor

    @koko57 Correct, but I believe we need to connect with Transaction collection in this case to make it work correctly.

    the report action has the IOUTransactionID and that transaction object holds the correct amount

  20. added
    ReviewingHas a PR in review
    and removed on Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringInternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions