[cp stag] fix: Hide pay button for non-reimbursable transactions report with 0 amount#87117
Conversation
|
@shubham1206agra 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.
Pull request overview
This PR prevents showing payment actions for expense reports that contain only non-reimbursable transactions when the net amount is 0, avoiding a “nothing happens” UX when attempting to pay/mark as paid.
Changes:
- Update pay-action eligibility checks to require a non-zero non-reimbursable spend when the report contains only non-reimbursable transactions.
- Hide the Pay button in report preview/header when the report has only non-reimbursable transactions and the report total is 0.
- Tighten
canIOUBePaid(..., onlyShowPayElsewhere=true)behavior for only-non-reimbursable reports with 0 amount.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/libs/ReportPrimaryActionUtils.ts |
Prevents PAY primary action for only-non-reimbursable reports when non-reimbursable spend is 0. |
src/libs/ReportPreviewActionUtils.ts |
Prevents PAY preview action for only-non-reimbursable reports when non-reimbursable spend is 0. |
src/libs/actions/IOU/index.ts |
Disables “pay elsewhere” eligibility for only-non-reimbursable reports when non-reimbursable spend is 0. |
src/components/ReportActionItem/MoneyRequestReportPreview/PayActionButton.tsx |
Hides the Pay button in the report preview for only-non-reimbursable reports with total 0. |
src/components/MoneyReportHeader.tsx |
Hides the Pay button in the money report header for only-non-reimbursable reports with total 0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Code Review Missed file: const shouldShowPayButton = isPaidAnimationRunning || canIOUBePaid || onlyShowPayElsewhere || reportHasOnlyNonReimbursableTransactions;This should be: const shouldShowPayButton = isPaidAnimationRunning || canIOUBePaid || onlyShowPayElsewhere || (reportHasOnlyNonReimbursableTransactions && (moneyRequestReport?.total ?? 0) !== 0);Without this, the bug is still reproducible wherever Rest of the changes look correct. The |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@samranahm please address review above |
|
On it, writing unit test. |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good with me 👍
…e transactions when total is 0
|
@situchan Please take a look. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-04-04.at.3.31.45.AM.mov |
| ? false | ||
| : !canIOUBePaid && canIOUBePaidAction(moneyRequestReport, chatReport, policy, bankAccountList, transaction ? [transaction] : undefined, true, undefined, invoiceReceiverPolicy); | ||
| const shouldShowPayButton = isPaidAnimationRunning || canIOUBePaid || onlyShowPayElsewhere || reportHasOnlyNonReimbursableTransactions; | ||
| const shouldShowPayButton = isPaidAnimationRunning || canIOUBePaid || onlyShowPayElsewhere || (reportHasOnlyNonReimbursableTransactions && (moneyRequestReport?.total ?? 0) !== 0); |
There was a problem hiding this comment.
NAB: It's same value under reportHasOnlyNonReimbursableTransactions = true but nonReimbursableTotal is more accurate.
There was a problem hiding this comment.
@situchan when reportHasOnlyNonReimbursableTransactions is true moneyRequestReport. total will always be same nonReimbursableTotal, but if you prefer nonReimbursableTotal we can switch to that since it would be more precise and self-documenting. Although the behaviour would remain same.
There was a problem hiding this comment.
yes, it's fine. Melvin raised the same concern here but not blocker since we're just checking if equals to 0
|
🤖 No, they are not exactly the same value. let nonReimbursableSpend = moneyRequestReport.nonReimbursableTotal ?? 0;
let totalSpend = moneyRequestReport.total ?? 0;
// ...
nonReimbursableSpend = isExpenseReport(moneyRequestReport) ? nonReimbursableSpend * -1 : Math.abs(nonReimbursableSpend);
totalSpend = isExpenseReport(moneyRequestReport) ? totalSpend * -1 : Math.abs(totalSpend);So for an expense report with only non-reimbursable transactions:
They differ in sign (and |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@cristipaval could you please take a look? |
|
🚧 @jasperhuangg has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…amount [cp stag] fix: Hide pay button for non-reimbursable transactions report with 0 amount (cherry picked from commit d45207d) (cherry-picked to staging by cristipaval)
|
🚀 Cherry-picked to staging by https://github.com/cristipaval in version: 9.3.52-8 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This PR fixes a bug where the Pay button incorrectly appeared on non-reimbursable expense reports with a $0 total. I reviewed all relevant help site articles:
The existing documentation already correctly implies that non-reimbursable reports don't need a Pay action. The bug was purely in the UI code, not a documented feature change. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.52-9 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/cristipaval in version: 9.3.53-0 🚀
Bundle Size Analysis (Sentry): |
|
I reviewed all help site articles under PR Change: Hides the Pay button for non-reimbursable expense reports when the total is $0. Articles Reviewed:
Conclusion: No help site changes are required. The existing articles describe the Pay button at a high level (e.g., "Pay appears after the report is approved for the Payer") and correctly note that "Approved is the final status for reports containing only non-reimbursable (e.g. company card) expenses." None of the articles make claims that contradict the new behavior — they don't state that a Pay button will appear for $0 non-reimbursable reports. This is a narrow edge-case fix that falls within the existing documentation's scope without conflicting with it. |
|
🚀 Cherry-picked to staging by https://github.com/cristipaval in version: 9.3.53-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.53-7 🚀
|
Explanation of Change
Fixed Issues
$ #87112
PROPOSAL:
Tests
Offline tests
QA Steps
same as test
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
macOS.Chrome.mp4