Restrict report state transitions to archived policies only - #98948
Restrict report state transitions to archived policies only#98948c3024 wants to merge 9 commits into
Conversation
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.
|
…ict-more-menu-archived-policies # Conflicts: # tests/unit/ReportPrimaryActionUtilsTest.ts # tests/unit/ReportSecondaryActionUtilsTest.ts
…ict-more-menu-archived-policies # Conflicts: # src/libs/ReportPreviewActionUtils.ts # src/libs/actions/IOU/ReportWorkflow.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f32667f64
ℹ️ 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".
|
@codex review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a7700cc17
ℹ️ 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".
|
|
||
| // State transitions are blocked only on archived or pending-delete policies. Reports archived for other reasons | ||
| // (e.g. the submitter was unshared from the policy) can still move through the workflow. | ||
| if (isArchivedOrPendingDeletePolicy(policy)) { |
There was a problem hiding this comment.
Use the policy archive gate for Search submissions
When an open expense report is archived because its submitter was removed from an otherwise active workspace, the new header and preview predicates allow Submit, but Search still calls canSubmitReport() with isIOUReportArchived || isChatReportArchived in SearchUIUtils.ts:2600; canSubmitReport() rejects that value at line 330. As a result, an admin can submit the removed member's report from the report view but not from Search or bulk actions. Apply isArchivedOrPendingDeletePolicy(policy) to the submit predicate too rather than retaining the NVP-based archive check.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3a2bffb. Search submit now passes isArchivedOrPendingDeletePolicy(policy) to canSubmitReport instead of the report NVP archive flags.
Explanation of Change
Report state transitions (Submit, Approve, Pay, Unapprove, Cancel payment, Retract, Reopen) are now hidden only when the report's policy is archived, keyed on
isArchivedPolicy. Reports archived for other reasons, such as the submitter being removed from the workspace, keep these actions so their outstanding reports can still be approved and paid. IOU and invoice reports keep the existing archived report checks because they have no policy archived state. The same keying is applied tocanIOUBePaid,canApproveIOUand the report preview actions, which drive the preview button and the settlement button payment options.Fixed Issues
$ #98868
PROPOSAL:
Tests
Removed member flow:
Archived policy flow:
Onyx.merge('policy_<policyID>', {archivedDate: '2026-01-01'})with the policyID created in step 1.Screen.Recording.2026-08-19.at.8.35.22.PM.mov
Screen.Recording.2026-08-19.at.8.32.06.PM.mov
Offline tests
Same as Tests.
QA Steps
Same as above.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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
Screen.Recording.2026-08-19.at.8.35.22.PM.mov
Screen.Recording.2026-08-19.at.8.32.06.PM.mov