-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix/79181 - "Pay with business account" option reappears in IOU preview after user re-login. #80330
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
Conversation
|
@justinpersaud 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] |
src/libs/ReportActionsUtils.ts
Outdated
| const getTransactionAmount = (transaction?: Transaction) => Number(transaction?.modifiedAmount || transaction?.amount || 0); | ||
|
|
||
| const firstNonZeroTransaction = reportTransactions.find((transaction) => getTransactionAmount(transaction) !== 0); | ||
| if (reportTransactions.length === 0 || !firstNonZeroTransaction) { |
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.
if (reportTransactions.length === 0)
For optimization, move this condition just below const reportTransactions =
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've changed to use doesReportContainRequestsFromMultipleUsers instead of creating a new helper, for consistency with the suggestion by ChatGPT.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
hasRequestFromCurrentAccount is also for IOU reports only, so using it will be fine.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7379429698
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
trjExpensify
left a comment
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.
Confirming that it's expected you can't pay with business account and thus convert the IOUReport to an expense report on the workspace when the IOUReport contains expenses from both parties. 👍
|
|
||
| function doesReportContainRequestsFromMultipleUsers(iouReport: OnyxEntry<Report>): boolean { | ||
| const transactions = getReportTransactions(iouReport?.reportID); | ||
| function doesReportContainRequestsFromMultipleUsers(iouReport: OnyxEntry<Report>, shouldExcludeDeletedTransactions = false): boolean { |
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.
Please add unit test for this updated function.
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.
A unit test has been added for hasRequestFromCurrentAccount, and it also covers the updated part of the doesReportContainRequestsFromMultipleUsers function.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
It appears that the ESLint check is encountering an error; I will re-trigger the checks later. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-01-25.at.11.48.37.PM.mov |
|
Please merge main and fix lint |
justinpersaud
left a comment
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.
need to fix lint
|
@justinpersaud It is ready. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/justinpersaud in version: 9.3.11-0 🚀
|
Explanation of Change
When the IOU report has not yet been loaded (due to a fresh login and the report not being opened), the "Pay with Business Account" option will always appear on the Pay button in the preview report within the chat report, even though we have expenses from both sides.
This PR ensures the correct display in this case.
Fixed Issues
$ #79181
PROPOSAL: #79181 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisites:
Steps:
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso 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.native.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.nativ.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
mac.safari.mp4