[$175] Hide Add approver and Reassign approver when DEW is enabled
Problem
New Expensify exposes Add approver and Reassign approver on workspaces using Dynamic External Workflows (DEW). Classic suppresses manual Approve and forward for these workspaces.
Manual reassignment conflicts with DEW-controlled routing: rerunning DEW can immediately move the report away from the selected approver.
Expected behavior
- Hide Add approver and Reassign approver whenever DEW is enabled.
- Preserve Bypass approver, including existing permissions.
- Preserve normal Approve behavior.
- Leave non-DEW workspaces unchanged.
Acceptance criteria
- Verify both options are hidden across report approval entry points for DEW workspaces.
- Verify eligible admins can still bypass approvers.
- Verify both options remain available, subject to existing permissions, for non-DEW workspaces.
Reported by @garrettmknight via DM with MelvinBot
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022122370259600655401
- Upwork Job ID: 2122370259600655401
- Last Price Increase: 2026-11-16
Issue Owner
Current Issue Owner: @hungvu193
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (External)
Job added to Upwork: https://www.upwork.com/jobs/~022122370259600655401
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspaces with Dynamic External Workflows (DEW) enabled currently expose the "Add approver" and "Reassign approver" options in report approval flows. Because approval routing on DEW workspaces is handled externally (and rerunning DEW immediately overrides any manual approver assignments), manual approver changes conflict with DEW routing. We need to hide "Add approver" and "Reassign approver" across all report approval entry points when DEW is enabled, while preserving "Bypass approver" (subject to existing permissions), keeping normal "Approve" functionality intact, and leaving non-DEW workspaces unchanged.
What is the root cause of that problem?
The action list generator in DynamicReportChangeApproverPage.tsx (lines 93–116) and SearchChangeApproverPage.tsx (lines 234–277) adds APPROVER_TYPE.ADD_APPROVER and APPROVER_TYPE.REASSIGN_APPROVER without checking if the workspace has Dynamic External Workflows enabled via hasDynamicExternalWorkflow(policy).
Furthermore:
ReportSecondaryActionUtils.ts(lines 1238–1241) andSearchUIUtils.ts(lines 2430–2433) add theCHANGE_APPROVERaction without verifying if any viable action remains when DEW is active (i.e. whether the user has permission to bypass approvers viaisAllowedToApproveExpenseReport).- The sub-routes for adding or reassigning an approver (
ReportAddApproverPage.tsx,ReportReassignApproverPage.tsx, andSearchApproverPage.tsx) do not includehasDynamicExternalWorkflow(policy)in theirshouldShowNotFoundViewchecks, permitting direct URL deep-link access even on DEW workspaces. - In
SearchChangeApproverPage.tsx,shouldAutoApplyApproverauto-executes the sole surviving action whenapproverTypes.length === 1. On normal workspaces, a single option isADD_APPROVER(which simply navigates to the add page). On DEW workspaces, when Add and Reassign are hidden, the single remaining option can beBYPASS_APPROVER. Without gatingshouldAutoApplyApprovertoAPPROVER_TYPE.ADD_APPROVER, opening the bulk change approver page would unexpectedly auto-trigger report reassignment (assignReportToMe) without user confirmation.
What changes do you think we should make in order to solve the problem?
-
Gate Single Report Approver Options (
src/pages/DynamicReportChangeApproverPage.tsx):- Check
const isDEW = hasDynamicExternalWorkflow(policy);. - Gate
APPROVER_TYPE.ADD_APPROVERandAPPROVER_TYPE.REASSIGN_APPROVERbehind!isDEW. - Initialize
selectedApproverTypestate toisDEW ? APPROVER_TYPE.BYPASS_APPROVER : APPROVER_TYPE.ADD_APPROVER. - In
shouldShowNotFoundView, returnNotFoundPageifisDEW && !isAllowedToApproveExpenseReport(report, currentUserDetails.accountID, policy)so that users without bypass permissions cannot access an empty change approver modal.
- Check
-
Gate Report Secondary Actions Menu (
src/libs/ReportSecondaryActionUtils.ts):- In
getReportSecondaryActions(around line 1238), only pushCONST.REPORT.SECONDARY_ACTIONS.CHANGE_APPROVERif:(!hasDynamicExternalWorkflow(policy) || isAllowedToApproveExpenseReport(report, currentUserAccountID, policy)) - This ensures the "Change approver" menu item is hidden on DEW workspaces when the user does not have permission to bypass approvers.
- In
-
Protect Direct Routes (
src/pages/ReportAddApproverPage.tsxandsrc/pages/ReportReassignApproverPage.tsx):- In
ReportAddApproverPage.tsx(line 144), add|| hasDynamicExternalWorkflow(policy)toshouldShowNotFoundView. - In
ReportReassignApproverPage.tsx(line 65), add|| hasDynamicExternalWorkflow(policy)toshouldShowNotFoundView. - This safely prevents direct deep-link access to Add Approver and Reassign Approver on DEW workspaces.
- In
-
Gate Search Bulk Actions & Search Change Approver Page (
src/pages/Search/SearchChangeApproverPage.tsx&src/libs/SearchUIUtils.ts):- In
src/libs/SearchUIUtils.ts(line 2430), gateCONST.SEARCH.ACTION_TYPES.CHANGE_APPROVERwith(!hasDynamicExternalWorkflow(policy) || isAllowedToApproveExpenseReport(report, currentUserAccountID, policy)). - In
src/pages/Search/SearchChangeApproverPage.tsx:- In
canReassignAllReports(line 88), check!hasDynamicExternalWorkflow(policy)for each report. - In
getApproverTypes(line 233), only pushAPPROVER_TYPE.ADD_APPROVERif all selected reports do not have DEW enabled (selectedReports.every(report => !hasDynamicExternalWorkflow(allPolicies?.[${ONYXKEYS.COLLECTION.POLICY}${report.policyID}]))). - In
shouldAutoApplyApprover(line 72), ensure auto-apply only occurs forAPPROVER_TYPE.ADD_APPROVER(e.g.return approverTypes.length === 1 && selectedApproverType === APPROVER_TYPE.ADD_APPROVER;) so thatBYPASS_APPROVERis never inadvertently auto-executed without user confirmation. - Ensure initial focus/selection resolves to
BYPASS_APPROVERwhen DEW is enabled, and if all options are excluded for the selected reports, the existing layout effect cleanly dismisses the RHP.
- In
- In
src/pages/Search/SearchApproverPage.tsx(lines 204, 231), ensurehasDynamicExternalWorkflow(policy)triggersshouldShowNotFoundViewfor DEW reports.
- In
-
Approve Action:
- Standard "Approve" action and buttons remain completely untouched across all screens and continue to operate normally.
What alternative solutions did you explore? (Optional)
Disabling the "Add approver" and "Reassign approver" list items with an informational banner instead of hiding them. However, hiding them aligns directly with the issue specification and matches Classic Expensify's behavior of suppressing manual approve-and-forward workflows on DEW workspaces.
Contributor details
- Email: [email protected]
- Upwork Profile: https://www.upwork.com/freelancers/~0131dae36abcf59374
Proposal
Please re-state the problem that we are trying to solve in this issue.
On workspaces using Dynamic External Workflows (DEW), the Change approver flow still offers Add approver and Reassign approver. DEW controls routing, so a manual change can be undone as soon as DEW reruns. These two options should be hidden for DEW workspaces while Bypass approvers and normal approval stay as they are.
What is the root cause of that problem?
Both Change approver pages build their option list without checking for DEW:
src/pages/DynamicReportChangeApproverPage.tsxalways addsAPPROVER_TYPE.ADD_APPROVERtodata, and addsREASSIGN_APPROVERwheneverisPolicyAdmin(policy) && !isPendingDeletePolicy(policy).src/pages/Search/SearchChangeApproverPage.tsx(bulk / Search entry point) does the same ingetApproverTypes(): Add approver always, Reassign gated only bycanReassignAllReports(), which checks admin, processing state andapprovalMode !== OPTIONAL, so DEW (APPROVAL_MODE.DYNAMICEXTERNAL) passes.
The entry point itself, CHANGE_APPROVER in src/libs/ReportSecondaryActionUtils.ts, only checks isApprovalEnabled (any mode other than OPTIONAL), so DEW reports open the page and see all three options. The app already has a helper for this, hasDynamicExternalWorkflow(policy) in src/libs/PolicyUtils/workflows.ts, used elsewhere (SubmitActionButton, PayActionButton, ReportWorkflow.ts), but not here.
What changes do you think we should make in order to solve the problem?
DynamicReportChangeApproverPage.tsx: computeconst isDEWPolicy = hasDynamicExternalWorkflow(policy);and only push the Add approver and Reassign approver items when!isDEWPolicy. Keep the Bypass approvers block unchanged.SearchChangeApproverPage.tsx: ingetApproverTypes(), skip Add approver if any selected report's policy is DEW, and add the same!hasDynamicExternalWorkflow(policy)check insidecanReassignAllReports()so Reassign is hidden too.- Default selection: both pages initialise
selectedApproverTypetoADD_APPROVER. When that option is hidden, the default should be the first available item (Bypass), otherwise the confirm button would act on a hidden option. On the Search page the existingshouldAutoApplyApprover/ auto-close logic already handles a one-item or empty list once the default is correct. ReportSecondaryActionUtils.ts: for a DEW policy, only showCHANGE_APPROVERwhen the user can actually bypass (isAllowedToApproveExpenseReport), so we never open an empty page.- Guard the direct routes (
ReportAddApproverPage,ReportReassignApproverPage, and the Search add/reassign pages) with a not-found view when the policy is DEW, so deep links can't get around the hidden options.
Non-DEW workspaces are unaffected because every new check is behind hasDynamicExternalWorkflow.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
tests/unit/ReportSecondaryActionUtilsTest.ts: DEW policy + admin who can bypass getsCHANGE_APPROVER; DEW policy + admin who can't bypass does not; a non-DEW Advanced workspace is unchanged.- A component test for
DynamicReportChangeApproverPage(like the existingReportReassignApproverPageTest.tsx): DEW policy renders only Bypass approvers; non-DEW renders all three for an eligible admin. canReassignAllReportsreturns false when any selected report's policy is DEW.
What alternative solutions did you explore? (Optional)
Hiding the whole Change approver action for DEW. I dropped that because the issue explicitly wants Bypass approvers kept.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On New Expensify workspaces with Dynamic External Workflows (DEW) enabled, the report approval UI still exposes Add approver and Reassign approver. Manual reassignment conflicts with DEW-controlled routing because rerunning DEW can immediately move the report away from the selected approver. Classic suppresses manual Approve and forward for DEW workspaces, so New Expensify should hide these two approver-management options as well, while preserving Bypass approver (with existing permissions), preserving normal Approve behavior, and leaving non-DEW workspaces unchanged.
What is the root cause of that problem?
The DEW policy flag is already consulted by the report action utilities, but not by the approver-option builders. In src/libs/ReportPrimaryActionUtils.ts, hasDynamicExternalWorkflow(policy) is imported and used to gate DEW-specific behavior (lines 146 and 205-206), alongside hasPendingDEWApprove/hasPendingDEWSubmit (lines 35-36). The option lists that expose Add approver and Reassign approver on report approval entry points (report history steps and action contents, e.g. src/pages/ReportHistoryPage/getReportHistorySteps.ts and src/pages/inbox/report/actionContents/ApprovalFlowContent.tsx, reached through src/pages/ReportReassignApproverPage.tsx) are built without any hasDynamicExternalWorkflow(policy) check, so both options remain visible on DEW workspaces.
What changes do you think we should make in order to solve the problem?
- At each report approval entry point where the option list is built (report page actions, history steps, action contents, and the reassign route), add a
!hasDynamicExternalWorkflow(policy)condition to Add approver and Reassign approver so both options are hidden whenever DEW is enabled. - Leave Bypass approver untouched so eligible admins can still bypass approvers with their existing permissions.
- Leave normal Approve behavior unchanged; the new condition is false on non-DEW workspaces, so they are unaffected.
- Add unit tests covering: both options hidden when DEW is enabled across entry points; Bypass approver still offered to eligible admins; both options still available subject to existing permissions on non-DEW workspaces.
What alternative solutions did you explore? (Optional)
Hiding the routes themselves for DEW workspaces was considered, but the option-level condition is the smaller change and matches how the codebase already gates DEW behavior via hasDynamicExternalWorkflow(policy) in src/libs/ReportPrimaryActionUtils.ts, satisfying the acceptance criteria across all report approval entry points without touching navigation.
Contributor details
Your Expensify account email: [email protected]
📣 @sofakingmc0804! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
What this adds over the existing proposals
Bulk Change approver would approve reports without asking. shouldAutoApplyApprover runs the action as soon as only one option is left (SearchChangeApproverPage.tsx#L72). On main that option can only be Add approver, which opens a page. Once Add and Reassign are hidden on DEW, it can be Bypass approvers, so opening the bulk page would call AssignReportToMe on every selected report. An existing unit test expected Bypass to auto-apply. That case couldn't happen on main, so I changed the test to expect the opposite.
The bulk page also defaults to Add approver, so it needs the same default-selection fix as the report page.
What is the root cause of that problem?
The change-approver code never calls hasDynamicExternalWorkflow (workflows.ts#L72):
- The report page always adds Add approver, and adds Reassign approver for any admin (DynamicReportChangeApproverPage.tsx#L93-L116). Its selection defaults to Add approver (#L55).
- The Search bulk page builds the same list (SearchChangeApproverPage.tsx#L233-L277).
- The Add and Reassign approver pages open from a direct URL with no DEW check (ReportAddApproverPage.tsx#L144, ReportReassignApproverPage.tsx#L65, SearchApproverPage.tsx#L231).
What changes do you think we should make in order to solve the problem?
DynamicReportChangeApproverPage: skip Add approver and Reassign approver whenhasDynamicExternalWorkflow(policy)is true. Bypass approvers keeps its existingisAllowedToApproveExpenseReportcheck. If the stored selection is hidden, select the first visible option, and use that forisSelected,initiallyFocusedItemKeyandchangeApprover, so Confirm can't open the hidden Add flow.SearchChangeApproverPage: apply the same rule when any selected report is on a DEW workspace, matching the page's "every report must qualify" checks.canReassignAllReportsreturnsfalsefor DEW, andshouldAutoApplyApprovernever fires for Bypass approvers.- Hide Change approver when nothing would be left. With DEW on and no right to bypass (for example, an admin who submitted the report while self-approval is off), the list would be empty. On DEW, the More menu entry (ReportSecondaryActionUtils.ts#L1238-L1241) and Search's
canChangeApprover(SearchUIUtils.ts#L2430-L2433) also requireisAllowedToApproveExpenseReport. ReportAddApproverPage,ReportReassignApproverPageandSearchApproverPageshow Not Found on DEW workspaces.
Approve, Bypass approvers and its permissions, and non-DEW workspaces don't change.
Tests:
- the report page shows only Bypass approvers, selected, on DEW, and all three options otherwise;
- bulk auto-apply never fires for Bypass approvers and still fires for Add approver;
canReassignAllReportsisfalseon DEW;- the More menu shows Change approver on DEW only when the admin can bypass, and always on non-DEW.
The fix and tests are ready on a branch.
What alternative solutions did you explore? (Optional)
Disabling the two options instead of hiding them. The issue asks for them to be hidden, and Classic hides them.
Before/after videos come from a local fixture: the real app with simulated backend replies, labelled on screen. Before, Change approver on the DEW report offers Add, Bypass and Reassign, and Confirm opens the Add approver list. After, it offers only Bypass approvers, and confirming calls AssignReportToMe. The regular workspace report still offers all three.
https://github.com/user-attachments/assets/70bd66ba-e1ce-402d-b609-9e41dadd3f79
https://github.com/user-attachments/assets/1d512c1e-2666-4a10-95db-9b8f3e8d22a7
@hungvu193 reassigning you since this relates to https://github.com/Expensify/Expensify/issues/700955
Proposal
(Latest version, updated Nov 16)
Please re-state the problem that we are trying to solve in this issue.
On workspaces using Dynamic External Workflows (DEW), the Change approver flow still offers Add approver and Reassign approver. DEW owns the approval routing, and rerunning it can immediately move the report away from a manually chosen approver, so these two manual options should be hidden whenever DEW is enabled. Bypass approver (with its existing permission checks), the normal Approve action, and non-DEW workspaces must stay exactly as they are.
What is the root cause of that problem?
The app already has the DEW check, hasDynamicExternalWorkflow(policy) in src/libs/PolicyUtils/workflows.ts (L72-L74) (approvalMode === DYNAMICEXTERNAL), and uses it for other DEW behavior, but the Change approver flow never calls it:
- The option lists are built without it.
DynamicReportChangeApproverPage.tsx(L93-L116) always adds Add approver, and adds Reassign approver whenever the user is a policy admin.SearchChangeApproverPage.tsx(L233-L277) (the Search bulk version) always adds Add approver, andcanReassignAllReports(L77-L105) treats DEW like any normal approval mode because it only excludesAPPROVAL_MODE.OPTIONAL. - The entry points do not consider what would remain.
ReportSecondaryActionUtils.ts(L1238-L1241) andSearchUIUtils.ts(L2431-L2434) show Change approver for any non-optional approval mode. On a DEW workspace where the admin cannot bypass, that opens a page whose options would all be hidden. - The deep links are unguarded.
ReportAddApproverPage.tsx(L144) andReportReassignApproverPage.tsx(L64-L72) have no DEW check in their not-found conditions, and inSearchApproverPage.tsx(L204-L208, L231) the guard only covers reassignment and only checks admin status, so the add-approver route has no not-found guard at all.
What changes do you think we should make in order to solve the problem?
- Gate the options on the report page. In
DynamicReportChangeApproverPage, computeisDEW = hasDynamicExternalWorkflow(policy)and only add Add approver and Reassign approver when it is false. Bypass approver stays behind its existingisAllowedToApproveExpenseReportcheck, untouched. - Fix the default selection, and keep the auto-apply safe. Both pages initialize
selectedApproverTypetoADD_APPROVER(report page L55, Search page L114). When that option is hidden, the selection must default to the first visible option so the confirm button acts on what is shown. On the Search bulk page,shouldAutoApplyApprover(L48-L75, applied at L298-L307) runs the single visible option without a confirm press. That is safe today because the only possible single option is Add approver, a navigation; once Add and Reassign can be hidden, the single option can be Bypass approver, which would silently runassignReportToMeon every selected report. The auto-apply must therefore stay limited to Add approver (navigation only) and never fire for Bypass approver: the page shows Bypass preselected and waits for the admin's confirm. - Gate the bulk page the same way. In
SearchChangeApproverPage, add!hasDynamicExternalWorkflow(policy)per selected report insidecanReassignAllReports, and only add Add approver when every selected report's policy is non-DEW. A mixed selection of DEW and non-DEW reports therefore shows only Bypass approver, and if nothing remains the existing layout effect already closes the RHP. - Hide Change approver when nothing would remain. In
ReportSecondaryActionUtilsandSearchUIUtils, only pushCHANGE_APPROVERwhen the policy is not DEW or the user can bypass (isAllowedToApproveExpenseReport), so a DEW admin without bypass permission never sees an entry point that leads to an empty page. - Guard the routes. Add
hasDynamicExternalWorkflow(policy)to the not-found conditions ofReportAddApproverPageandReportReassignApproverPage, and extend the guard inSearchApproverPageso both the add and reassign routes show not-found when any selected report's policy is DEW.
Non-DEW workspaces are unaffected because every new condition sits behind hasDynamicExternalWorkflow. I checked all of this against main; I could not run a DEW workspace end to end, so the classic-parity behavior is taken from the issue description.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
tests/unit/ReportSecondaryActionUtilsTest.ts: DEW policy + admin who can bypass sees Change approver; DEW policy + admin who cannot bypass does not; a non-DEW Advanced or Collect policy is unchanged.- A page test for
DynamicReportChangeApproverPage(mirroring the existingReportReassignApproverPageTest.tsx): DEW renders only Bypass approver with Bypass as the default selection; non-DEW renders all three for an eligible admin. shouldAutoApplyApproverreturns false when the only visible option is Bypass approver, so the bulk page never assigns without a confirm press.canReassignAllReportsreturns false when any selected report's policy is DEW.- Route tests: the add and reassign routes render not-found on a DEW policy, including the Search add-approver route.
What alternative solutions did you explore? (Optional)
- Hiding the whole Change approver entry point for DEW: rejected, the issue requires Bypass approver to stay available.
- Disabling the two options with an explanation instead of hiding them: rejected, the issue says hide, and the pages already handle an empty or single-option list cleanly.
- Letting the single-option auto-apply run Bypass approver: rejected, a bulk approval change must not happen without the admin pressing confirm.
- In a mixed bulk selection, hiding the options per report instead of hiding them when any selected report is DEW: rejected, adding or reassigning one approver across reports with different routing rules is exactly the conflict DEW creates, so the safer rule is to hide when any selected report is DEW.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~016176d06dd16a08b7
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~014898525b9c53fc32
Proposal
Please re-state the problem that we are trying to solve in this issue.
On workspaces where Dynamic External Workflows (DEW) are enabled (hasDynamicExternalWorkflow(policy) === true), the report approval interface currently presents Add approver and Reassign approver actions across single report change-approver and bulk search change-approver entry points. Because DEW relies on external automated routing rules, manual reassignment or manual approver insertion directly conflicts with DEW routing, causing re-evaluations to overwrite manual assignments.
What is the root cause of that problem?
- Single Report Entry (
DynamicReportChangeApproverPage.tsx:93-116):ADD_APPROVERis unconditionally pushed to thedataarray as the baseline option regardless ofhasDynamicExternalWorkflow(policy).REASSIGN_APPROVERis guarded only byisPolicyAdmin(policy) && !isPendingDeletePolicy(policy)without checking if the policy has DEW active.selectedApproverTypestate defaults unconditionally toAPPROVER_TYPE.ADD_APPROVER, which becomes invalid whenADD_APPROVERis omitted.shouldShowNotFoundViewdoes not check if all options are hidden (e.g., DEW enabled and user lacks bypass permissions).
- Bulk Search Selection Entry (
SearchChangeApproverPage.tsx:77-105, 235-275):canReassignAllReportschecksisApprovalEnabled,isPolicyAdmin, etc., but does not verify whether any selected workspace has DEW enabled (!hasDynamicExternalWorkflow(policy)).- In
getApproverTypes(),ADD_APPROVERis pushed unconditionally into the options array unless explicitly gated by DEW checks acrossselectedPolicies. - In
shouldAutoApplyApprover(), auto-applyingBYPASS_APPROVERwhen it is the sole surviving option on DEW workspaces requires ensuringselectedApproverTypealigns with the first available option rather than defaulting to the suppressedADD_APPROVER.
What changes do you think we should make in order to solve the problem?
-
Gate Single Report Actions in
DynamicReportChangeApproverPage.tsx:- Import
hasDynamicExternalWorkflowfrom@libs/PolicyUtils. - Compute
const isDEW = hasDynamicExternalWorkflow(policy);. - Only include
ADD_APPROVERwhen!isDEW:const data: Array<ListItem<ApproverType>> = []; if (!isDEW) { data.push({ text: translate('iou.changeApprover.actions.addApprover'), keyForList: APPROVER_TYPE.ADD_APPROVER, alternateText: translate('iou.changeApprover.actions.addApproverSubtitle'), isSelected: selectedApproverType === APPROVER_TYPE.ADD_APPROVER, }); } - Gate
REASSIGN_APPROVERwith!isDEW:if (isPolicyAdmin(policy) && !isPendingDeletePolicy(policy) && !isDEW) { data.push({ text: translate('iou.changeApprover.actions.reassignApprover'), keyForList: APPROVER_TYPE.REASSIGN_APPROVER, alternateText: translate('iou.changeApprover.actions.reassignApproverSubtitle'), isSelected: selectedApproverType === APPROVER_TYPE.REASSIGN_APPROVER, }); } - Initialize
selectedApproverTypedynamically based on the first valid option (e.g.isDEW ? APPROVER_TYPE.BYPASS_APPROVER : APPROVER_TYPE.ADD_APPROVER). - Update
shouldShowNotFoundViewso that ifdata.length === 0(e.g., a DEW workspace where the user is not permitted to bypass approvers), the page cleanly displays<NotFoundPage />.
- Import
-
Gate Bulk Search Approver Actions in
SearchChangeApproverPage.tsx:- In
canReassignAllReports, add the condition!hasDynamicExternalWorkflow(policy). If any selected report belongs to a DEW policy, reassign is disallowed for the batch. - In
getApproverTypes(), check if any selected policy has DEW enabled:
Only pushconst hasDEWPolicy = selectedPolicies.some((policy) => hasDynamicExternalWorkflow(policy));ADD_APPROVERwhen!hasDEWPolicy. - When only
BYPASS_APPROVERremains, ensure initial focus and selection fall onAPPROVER_TYPE.BYPASS_APPROVERto allow smooth confirmation without accidental auto-submission mismatches.
- In
-
Automated Unit & UI Tests:
- Add unit tests in
tests/unit/SearchChangeApproverPageTest.tsvalidating thatcanReassignAllReportsreturnsfalsewhen any report is under a DEW workspace. - Add UI tests in
tests/ui/DynamicReportChangeApproverPageTest.tsxvalidating:- Non-DEW workspace displays Add approver, Bypass approver (if permitted), and Reassign approver.
- DEW workspace displays only Bypass approver (when permitted).
- DEW workspace renders
NotFoundPagewhen the user does not have bypass permissions.
- Add unit tests in
What alternative solutions did you explore? (Optional)
- Disabling the buttons with a tooltip instead of hiding them: Rejected because the issue specification explicitly requests to "Hide Add approver and Reassign approver when DEW is enabled" to align New Expensify with Classic Expensify's established behavior.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Updated Corrected the bulk auto-apply point; latest version is in my original comment above.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01299e59c8e06848f1
⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.
Sorry guys, this is an internal issue.
Hi! I'm interested in working on this issue. I have a complete fix already coded and tested locally. Could I be assigned? I can submit the PR immediately once assigned. Stack: React Native + TypeScript. All communication is async/written — no calls needed.
Proposal
Please re-state the problem that we are trying to solve in this issue.
New Expensify shows Add approver and Reassign approver options on workspaces that use Dynamic External Workflows (DEW). These actions conflict with DEW-controlled routing — rerunning DEW can immediately override any manual reassignment, creating a confusing UX. Classic already suppresses these for DEW workspaces.
What is the root cause of that problem?
DynamicReportChangeApproverPage and SearchChangeApproverPage render the Add/Reassign approver options without checking if the current workspace has DEW enabled. The DEW flag is available via the policy object in Onyx but is never consulted in these pages.
What changes do you think we should make in order to solve the problem?
File 1 — src/pages/DynamicReportChangeApproverPage.tsx
- Retrieve the workspace policy via
usePolicy(report?.policyID). - Compute
isDEWEnabled = policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL && !!policy?.externalApprovalEnabled(or the existing DEW helper if one exists). - Conditionally hide the Add approver and Reassign approver list items when
isDEWEnabledis true. - Bypass approver must remain visible and unaffected.
File 2 — src/pages/Search/SearchChangeApproverPage.tsx
- Same pattern for the bulk-search reassign path: derive
isDEWEnabledfrom the workspace policy of the selected reports' common policy, or hide across all DEW workspaces.
No backend changes required — this is a pure UI gate using existing Onyx data.
What specific scenarios should we test?
- DEW workspace: open report → three-dot menu → Add approver and Reassign approver must be absent.
- DEW workspace: Bypass approver must still appear.
- Non-DEW workspace: all three options visible (no regression).
- Search bulk-select on DEW workspace reports → Reassign must be hidden.
Are there any concerns with your approach?
None. The DEW flag is a stable Onyx value already synced during policy load. No additional API calls needed.
Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
:warning: Failed to process issue for release 9.5.53-3
Details
Server Error