fix: prevent Move expense from appearing on forwarded reports#83146
Draft
mavrickdeveloper wants to merge 1 commit intoExpensify:mainfrom
Draft
fix: prevent Move expense from appearing on forwarded reports#83146mavrickdeveloper wants to merge 1 commit intoExpensify:mainfrom
mavrickdeveloper wants to merge 1 commit intoExpensify:mainfrom
Conversation
2ee1a2c to
cc33877
Compare
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Add hasForwardedByManagerChange() fallback in isReportOutstanding() to detect forwarded reports when the FORWARDED action is missing from local Onyx data (e.g. in copilot/delegate sessions). The fallback compares getSubmitToAccountID() against managerID for processing reports, with a DEW guard to skip when pending approve/submit exists.
cc33877 to
5d9a8a4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
FORWARDEDaction is missing from local Onyx data (e.g. in copilot/delegate sessions).Root Cause:
isReportOutstanding()relies onhasForwardedAction()to detect forwarded reports, but this check only inspects locally availableREPORT_ACTIONS.FORWARDEDaction may not be present in local Onyx data, causing the report to appear outstanding when it has actually been forwarded to a higher-level approver.Solution:
hasForwardedByManagerChange()fallback inisReportOutstanding()that detects forwarded reports by comparinggetSubmitToAccountID()againstmanagerIDfor processing reports.hasPendingDEWApprove()/hasPendingDEWSubmit()to skip the fallback when a DEW operation is pending, preventing false positives.isProcessingReport()), so open/draft/approved/paid reports are unaffected.Known limitation:
PERSONAL_DETAILS_LIST(partial Onyx hydration),getSubmitToAccountID()may return a synthetic ID that doesn't matchmanagerID, causing a conservative false positive (Move hidden when it should be visible). The failure mode is conservative , it over-hides rather than over-shows.Fixed Issues
$ #79602
PROPOSAL: #79602 (comment)
Tests
Prerequisites:
Primary Tests (Fix Validation):
Non-Regression Tests:
As User B, find an outstanding expense report (submitted by User A, not yet approved)
Select the expense via checkbox in Search > Expenses
Open bulk actions menu
Verify "Move expense" IS shown in the menu
Select a paid expense via checkbox
Open bulk actions menu
Verify "Move expense" is NOT shown
Select a held expense via checkbox
Open bulk actions menu
Verify "Move expense" is NOT shown
Copilot/Delegate Session Test:
Offline tests
N/A - The fix operates on locally cached Onyx data (
REPORT_ACTIONS,REPORT_METADATA,PERSONAL_DETAILS_LIST). Move expense eligibility is determined client-side from already-synced state.QA Steps
Same as Primary Tests (steps 1–6) and Non-Regression Tests (steps 7–16) above.
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
Web: Move expense hidden on forwarded report
Web: Move expense visible on outstanding (non-forwarded) report
Web: Move expense hidden on paid report
Web: Move expense hidden on held report