Fix the incorrect payer name on the non-reimbursable transaction#37773
Conversation
…alternate text and IOU report header
|
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
mollfpr
left a comment
There was a problem hiding this comment.
While working on the PR, I tried to create a util function to return the payer name based on the IOU report, but I noticed it's hard to read the code because we have separate checks for the verb key to combine them with the payer name.
To make matters things simple, I just update the variable that holds the payer name to correctly use the ownerAccountID in the individual function to give more idea and align with the logic for the verb key.
Also, I noticed that we don't need to check if it's a card transaction because I believe the check is already covered in hasNonReimbursableTransactions.
| if (isApproved) { | ||
| return translate('iou.managerApproved', {manager: payerOrApproverName}); | ||
| } | ||
| const managerName = isPolicyExpenseChat && !hasNonReimbursableTransactions ? ReportUtils.getPolicyName(chatReport) : ReportUtils.getDisplayNameForParticipant(managerID, true); |
There was a problem hiding this comment.
The check !hasNonReimbursableTransactions is not needed here, so that's why I using the previous variable to get the payer name.
| } | ||
|
|
||
| if (hasNonReimbursableTransactions(report?.reportID)) { | ||
| if (!isSettled(report?.reportID) && hasNonReimbursableTransactions(report?.reportID)) { |
There was a problem hiding this comment.
An issue I stumbled upon while working on the PR is that after the non-reimbursable transaction is paid and clicking on the report preview, the money report header still shows <name> spent instead of <name> paid.
Screen.Recording.2024-03-05.at.21.33.16.mp4
So adding the check if the transaction paid shows the spent verb.
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / Safaripayee.movpayer.movMacOS: Desktop |
| const totalAmount = getMoneyRequestSpendBreakdown(report).totalDisplaySpend; | ||
| const policyName = getPolicyName(report, false, policy); | ||
| const payerName = isExpenseReport(report) && !containsNonReimbursable ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport); | ||
| const payerName = isExpenseReport(report) ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport); |
There was a problem hiding this comment.
Yes, I believe so!
@grgia Do you mind confirming if the above result is correct?
|
Friendly bump @grgia |
grgia
left a comment
There was a problem hiding this comment.
I triggered a test build so we can more quickly test various cases of headers
|
@mollfpr @aimane-chnaif could you confirm if this case is also fixed by this PR? |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
yes exactly. It's |
|
@mollfpr could you merge main? |
|
Fixed the conflict! |
|
Thank you @mollfpr, I'm just going to have a second pair of eyes take a look at the adhoc build before I merge :) |
grgia
left a comment
There was a problem hiding this comment.
code LGTM, holding merge on extra internal testing
|
Hmm how do I use the links here? It seems I don't have access
|
|
@grgia looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
not sure what happened there |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |




Details
Change the logic on defining the payer name for a non-reimbursable transaction to show the requestor name instead of the manager/approver name of the workspace.
Fixed Issues
$ #36186
PROPOSAL: #36186 (comment)
Tests
Contributor can't get access to the Expensify Card transaction, so instead we can create a manual request data and merge the data with the dummy Expensify card data via the console. For speed things up, you can put the above code in the component (e.g.,
ReportScreen).transactionIDfor the manual request you just createdtransactionID<requestor's name> spent5a. Alternate text on LHN

5b. Report preview

5c. Money report preview header


Offline tests
Same as the tests.
QA Steps
<requestor's name> spent3a. Alternate text on LHN

3b. Report preview

3c. Money report preview header


PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop