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

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

Closed
6 tasks done
trjExpensify opened this issue Oct 20, 2023 · 88 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2

Comments

@trjExpensify
Copy link
Contributor

trjExpensify commented Oct 20, 2023

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: 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
@trjExpensify trjExpensify added Engineering Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Bug Something is broken. Auto assigns a BugZero manager. labels Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@koko57
Copy link
Contributor

koko57 commented Oct 20, 2023

Ready to work on this issue 😊

@trjExpensify
Copy link
Contributor Author

Wahoo, thanks!

@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@mountiny
Copy link
Contributor

@koko57 let us know if you have any questions

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@koko57
Copy link
Contributor

koko57 commented Oct 23, 2023

@mountiny thanks! for now - no questions 🙂

@koko57
Copy link
Contributor

koko57 commented Oct 24, 2023

Still working on it.

I've got one question: what about splits?
Screenshot 2023-10-24 at 16 47 51
Should we add requestor name before 'split [amount]'?

@mountiny
Copy link
Contributor

hmm good question, given its a group and it could bea nyone it makes sense that we add their name there

@koko57
Copy link
Contributor

koko57 commented Oct 26, 2023

@mountiny @trjExpensify sorry it takes me so long, but this logic is very confusing and I think a major refactor here is necessary. Just to make sure: do we want to make it under this ticket or should I fix the issue first (in as easy and safe way as possible) and then plan some bigger changes as a follow-up? WDYT?

@koko57
Copy link
Contributor

koko57 commented Oct 26, 2023

and my second question here regarding the requestor: for other chats, we have a logic not to show the lastActorDisplayName when it's a current user.
So if the IOU report looks like this:

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

It looks like we want to display it that way for Jeff. For Tom the title will be the same. What about the last message? Should it look the
same for Tom? Or should it just say "requested $5.00 for Thursday Lunch"?

What about the workspace?

@koko57
Copy link
Contributor

koko57 commented Oct 27, 2023

@mountiny @trjExpensify are these correct?
Screenshot 2023-10-27 at 11 21 01
Screenshot 2023-10-27 at 11 21 38

@mountiny
Copy link
Contributor

I think we can refactor it here, we do not have to rush and i agree this has been a resource of lots of issues so if we can find a better cleaner solution that will be be great

In terms of the requestor, i think this is a great question and i feel like this might be unnecessary complication we could get rid off to simplify stuff. What do you think @trjExpensify?

On the screenshots the expected results say the paid message feom the workspace in case of workspace chat lhn preview should say the workspace name paid, the name of payer is only in the expense report

@trjExpensify
Copy link
Contributor Author

Heya! Catching up after being out for a couple of days last week.

In terms of the requestor, i think this is a great question and i feel like this might be unnecessary complication we could get rid off to simplify stuff. What do you think @trjExpensify?

The logic for when the iou/expenseReport LHN preview line has a name proceeding it or not should be exactly the same as a "normal" message in a chat. Why wouldn't we keep that consistency? So if it's your own request, you don't see your name. If it's someone else's request, you do see the requestor's name.

On the screenshots the expected results say the paid message feom the workspace in case of workspace chat lhn preview should say the workspace name paid, the name of payer is only in the expense report

Correct! The workspace chat/DM LHN preview is simply the title of the iou/expenseReport being previewed. So in this case once the report being previewed has been paid it would be:

expenseReport: Duraflame paid $50.00
iouReport: Tom Rhys Jones paid $50.00

@koko57
Copy link
Contributor

koko57 commented Oct 31, 2023

Still working on it. Tomorrow I'll be ooo (bank holiday in Poland) will continue on Thursday

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jan 5, 2024
@trjExpensify
Copy link
Contributor Author

Looks like we're working through a follow-up PR, Melv!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 8, 2024
@mountiny
Copy link
Contributor

The follow up has been merged too

@melvin-bot melvin-bot bot removed the Overdue label Jan 10, 2024
@mountiny
Copy link
Contributor

I think we can pay this out to @mananjadhav @trjExpensify

I am not sure if this should be counted as a regression or not

@trjExpensify
Copy link
Contributor Author

If we had to revert it once, that seems like it counts as a regression to me unfortunately. Open to other thoughts on that!

@koko57
Copy link
Contributor

koko57 commented Jan 11, 2024

@mountiny @trjExpensify what about the other follow-ups? Will we have another ticket for that and close this one or we'll have this one left opened?

By the follow-ups I mean the one we discussed in doubled payer's PR #33966 (comment) (I also mentioned this earlier)

and what about this one?

  • name of the user sending a message in multiple users' chat is not displayed

Let me know wdyt 🙂

@mananjadhav
Copy link
Collaborator

@mountiny @trjExpensify I understand about the regression but this one was a difficult PR. I was earlier going to request for the increase in the bounty but considering that we had a regression, if we can payout the standard amount that would be great.

@mountiny
Copy link
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

@trjExpensify
Copy link
Contributor Author

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!

@mountiny
Copy link
Contributor

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

@trjExpensify trjExpensify 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. Jan 12, 2024
@mananjadhav
Copy link
Collaborator

I've requested the payment on NewDot.

@trjExpensify
Copy link
Contributor Author

Closing!

@JmillsExpensify
Copy link

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

@paultsimura
Copy link
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

@mountiny
Copy link
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

@koko57
Copy link
Contributor

koko57 commented Jan 22, 2024

@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

@mountiny
Copy link
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2
Projects
No open projects
Development

No branches or pull requests

8 participants