-
Notifications
You must be signed in to change notification settings - Fork 3k
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
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check !hasNonReimbursableTransactions
is not needed here, so that's why I using the previous variable to get the payer name.
@@ -2090,7 +2089,8 @@ function getMoneyRequestReportName(report: OnyxEntry<Report>, policy: OnyxEntry< | |||
return `${payerPaidAmountMessage} • ${Localize.translateLocal('iou.pending')}`; | |||
} | |||
|
|||
if (hasNonReimbursableTransactions(report?.reportID)) { | |||
if (!isSettled(report?.reportID) && hasNonReimbursableTransactions(report?.reportID)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -2374,7 +2374,7 @@ function getReportPreviewMessage( | |||
const containsNonReimbursable = hasNonReimbursableTransactions(report.reportID); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe so!
@grgia Do you mind confirming if the above result is correct?
Friendly bump @grgia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
).transactionID
for the manual request you just createdtransactionID
<requestor's name> spent
5a. Alternate text on LHN
5b. Report preview
5c. Money report preview header
Offline tests
Same as the tests.
QA Steps
<requestor's name> spent
3a. Alternate text on LHN
3b. Report preview
3c. Money report preview header
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop