Fix missing "Waiting to approve" next step on Submit workspaces#93761
Draft
abzokhattab wants to merge 2 commits into
Draft
Fix missing "Waiting to approve" next step on Submit workspaces#93761abzokhattab wants to merge 2 commits into
abzokhattab wants to merge 2 commits into
Conversation
Submit (submit2026) workspaces hide approvals in the UI but always run an advanced approval workflow internally, so the synced approvalMode can be missing or optional on the client. That caused the SUBMITTED next step to short-circuit to the no-approval/pay path and skip "Waiting for X to approve". Resolve the approval workflow to ADVANCED for Submit workspaces in getApprovalWorkflow, and stop the SUBMITTED short-circuits in NextStepUtils from firing for Submit workspaces.
isApproveAction (primary action) and canApprove (report preview action) gated the Approve button on `policy.approvalMode !== OPTIONAL`, which hid it for Submit workspaces whose synced approvalMode can be optional/missing. Treat Submit workspaces as approval-enabled so the manager can approve (which triggers the upgrade flow), mirroring the Next Steps fix.
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
On Submit-tier workspaces (
submit2026), approvals are shown as disabled in the UI, but the workspace always runs an advanced approval workflow internally (the submitter submits to a specific approver). As a result, theapprovalModesynced to the client can be missing oroptional.A lot of approval-aware logic gates behavior on
policy.approvalMode !== OPTIONAL, so on Submit workspaces:This PR fixes that:
Root cause (Next Steps):
PolicyUtils.getApprovalWorkflownow resolves the approval workflow toADVANCEDfor Submit workspaces, regardless of theapprovalModesynced from the backend. This is the central helper used by Next Steps (and other approval-aware logic), so it fixes the root cause in one place.NextStepUtils— the twoSUBMITTEDearly-returns (buildOptimisticNextStepandbuildNextStepNew) no longer short-circuit to the no-approval path for Submit workspaces, so the "Waiting for … to approve" step is shown.Same problem elsewhere (Approve action hidden):
ReportPrimaryActionUtils.isApproveActionandReportPreviewActionUtils.canApprovecomputedisApprovalEnableddirectly frompolicy.approvalMode, hiding the Approve action for Submit workspaces. They now treat Submit workspaces as approval-enabled (additiveisSubmitPolicy(policy)guard, so non-Submit behavior is unchanged) — the approver can approve, which triggers the upgrade flow.Other call sites audited — intentionally NOT changed
These also read
policy.approvalModedirectly but are not the same problem for Submit workspaces:ReportPrimaryActionUtils.isPrimaryPayAction!isPaidGroupPolicy(policy)(Submit isn't paid).ReportPreviewActionUtils.canPayfalseregardless.actions/IOU/ReportWorkflow.ts(Pay)TODO+!isPaidGroupPolicyearly return).ReportSecondaryActionUtils&SearchUIUtilsCHANGE_APPROVERactions/IOU/Hold.ts,SearchUIUtilsapprove-suggestion / segmentationFixed Issues
$ #93685
PROPOSAL:
Tests
submit2026beta and create a Submit workspace (or use an existing one).<approver>to approve expenses" to the submitter / other viewers).optional) still shows the no-approval next step and hides Approve (no regression).Offline tests
<approver>to approve expenses".QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)STYLE.md) were followedgetApprovalWorkflow/approvalModeconsumers — see "Other call sites audited" above)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