[Payment due @Krishna2323] Exclude reports with all expenses on hold from Submit/Approve/Pay to-dos#92499
Conversation
|
@Eskalifer1 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] |
|
@marufsharifi 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8c7d91c39
ℹ️ 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".
| const reportTransactions = transactionsByReportID[report.reportID] ?? []; | ||
| const reportMetadata = allReportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`]; | ||
| if (isSubmitAction(report, reportTransactions, reportMetadata, policy, reportNameValuePair, undefined, login, currentUserAccountID)) { | ||
| if (isSubmitAction(report, reportTransactions, reportMetadata, policy, reportNameValuePair, undefined, login, currentUserAccountID) && !hasOnlyHeldExpenses(reportTransactions)) { |
There was a problem hiding this comment.
Filter pending-delete transactions for held-only to-dos
When a report has only held active expenses plus an unheld transaction that is pending deletion (for example, after deleting/moving an expense while offline or before the delete request syncs), transactionsByReportID still includes that pending-delete transaction, so this new hasOnlyHeldExpenses(reportTransactions) guard returns false and the report stays in Submit/Approve/Pay to-dos. The report header path already filters pending deletes before computing the primary action (useReportPrimaryAction.ts:46-53), so the to-do counts can disagree with the actionable UI in that state; filter pending-delete transactions before applying the new held-only checks.
Useful? React with 👍 / 👎.
|
Hi @allgandalf I'll be partially unavailable this Friday (after lunch) and OOO all next week, so I won't be able to work on this PR. I see that it’s on HOLD, so we can wait, but if the PR is ready to work on (the backend will be ready) and I won’t be around for a few more days (since I don’t think it makes sense to reassign it, say, on Friday evening), then feel free to reassign this issue, for example, to the second C+ who was assigned here. Thanks! |
|
I'm re-assigning to @Krishna2323 since they were already working on #85861 |
…e the all-held check
# Conflicts: # config/eslint/eslint.seatbelt.tsv
JmillsExpensify
left a comment
There was a problem hiding this comment.
I guess I didn't approve earlier.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid_hybrid.mp4Android: mWeb Chromeandroid_mWeb.mp4iOS: HybridAppios_hybrid.mp4iOS: mWeb Safariios_mWeb.mp4MacOS: Chrome / Safariweb_chrome_approve.mp4web_chrome_pay.mp4web_chrome_submit.mp4 |
@allgandalf Looks like the screenshots/videos are missing from the author checklist 😅 |
|
can you proceed as is? i'm done for the day, it would take me tomorrow to upload the recording for Web |
|
🎯 @Krishna2323, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
@allgandalf conflicts |
|
@allgandalf friendly bump to resolve the conflicts |
# Conflicts: # config/eslint/eslint.seatbelt.tsv
58229c6
|
🚧 @luacmartins has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.9-0 🚀
Bundle Size Analysis (Sentry): |
Help site review — changes requiredYes. This PR introduces a user-visible behavior change worth documenting: reports where every expense is on hold are now excluded from the Submit, Approve, and Pay to-dos (Home For you, Inbox type-menu badges, and Search), and an all-held report now surfaces Remove hold as its primary action instead of Submit/Approve/Pay. I created a draft help site PR updating two articles:
UI label verified against Draft PR: #93744 @allgandalf, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.9-0 🚀
|
Explanation of Change
Reports where every expense is on hold were still counted in the Submit, Approve, and Pay to-dos on Home (For You), the Inbox type-menu badges, and the Search expense-reports tab, even though the user can't act on them until the hold is removed. All three counts come from
ONYXKEYS.DERIVED.TODOS(createTodosReportsAndTransactions), and itsisSubmitAction/isApproveAction/isPrimaryPayActiongates never looked at hold state. Added a!hasOnlyHeldExpenses(reportTransactions)guard to each of the three pushes, matching the existing!hasOnlyNonReimbursableTransactionsguard already on the pay push.Also updated
getReportPrimaryActionso an all-held report the user can unhold surfaces Remove Hold on the report header instead of Approve or Submit, reusing the existing Remove Hold fallback that already handled the pay case.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/637331
PROPOSAL: N/A (internal bug fix, BE contributor assigned)
Tests
Approve case:
Submit case:
Pay case:
Offline tests
The to-do counts are a client-side Onyx derived value with no network dependency, so the behavior is identical offline. With an all-held report already in Onyx, go offline and confirm the report is still excluded from the Submit/Approve/Pay counts and that the report header still shows Remove Hold.
QA Steps
Same as Tests.
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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari