fix: prevent submitter from editing expenses after workflow forwardsTo becomes submitsTo#90211
Open
nabi-ebrahimi wants to merge 7 commits into
Open
Conversation
…ardsTo becomes submitsTo
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Contributor
Author
|
Hi @FitseTLT, The PR is ready for review. Thank you! |
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
This change keeps forwarded expense reports locked down, even if the workspace approval workflow is later edited to make the current manager look like the first-level approver again.
Previously, submitters could regain edit access because we only checked the live policy workflow against the report’s current manager. That missed the historical fact that the report had already been forwarded after submission. Now we also look at the report’s action history: if it was forwarded after the most recent submission, we treat it as past first-level approval and prevent submitters from editing the report policy or expense details.
This protects the approval flow from being accidentally reopened by later policy changes, while still allowing normal edits before a report has actually moved forward in approval.
Fixed Issues
$ #89012
PROPOSAL: #89012 (comment)
Tests
Preconditions:
Create the following accounts:
Log in as the Workspace Owner.
Create a new Control Workspace.
Invite User A, User B, and User C to the workspace.
Navigate to Workflows and click Add Approval Workflow.
Configure the approval workflow:
Log in as User A (Submitter).
Create and submit an expense report.
Log in as User B and approve the expense report.
Log back in as User A and open the submitted expense report.
Verify that the expense report is not editable.
Log in as the Workspace Owner.
Update the approval workflow:
Log back in as User A and open the expense report again.
Verify that the expense report remains not editable after the workflow update.
Offline tests
Same as Tests.
QA Steps
Same as Tests.
// 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
Android: Native
Recording_20260512_165245.mp4
Android: mWeb Chrome
Recording_20260512_165857.mp4
iOS: Native
Screen.Recording.2026-05-12.at.5.05.39.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-05-12.at.5.08.38.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-12.at.4.36.14.PM.mov