Part of https://github.com/Expensify/Expensify/issues/668027
Context
SetVacationDelegate with overridePolicyDiffWarning: false returns jsonCode 305 with data.policyDiff = {adminPolicies, nonAdminPolicies} (two lists of policy IDs, split by whether the requester is an admin) when the delegate is missing from some workspaces. The server writes nothing on a 305. NewDot ignores the data and only shows a generic confirm modal (VacationDelegatePage.tsx#L71-L88).
Changes
Replace the modal with a step in the RHP that renders one of three variations:
- Admin of none (
adminPolicies empty): explain that the admins will get an email. One button, "Confirm".
- Admin of all (
nonAdminPolicies empty): offer "Invite" and "Skip".
- Admin of some (both lists filled): show both sections, offer "Invite" and "Skip".
If there is no diff, the first call sets the delegate and the step never appears. Workspace names and avatars come from the local policy_ Onyx collection.
| Button |
API calls |
Emails |
| Confirm |
SetVacationDelegate(overridePolicyDiffWarning=true) |
sent |
| Invite |
one AddMembersToWorkspace per admin policy, then SetVacationDelegate(overridePolicyDiffWarning=true) |
sent for the non-admin workspaces in the mixed case |
| Skip |
SetVacationDelegate(overridePolicyDiffWarning=true, skipPolicyInviteEmails=true) |
none |
- Add
skipPolicyInviteEmails to SetVacationDelegateParams and pass it through the setVacationDelegate action.
- Read
response.data.policyDiff instead of discarding it.
- "Invite" loops the existing
addMembersToWorkspace action, one call per admin policy (per the bulk-action guideline and the 1:1:1 rule), then calls SetVacationDelegate.
- The 305 response merges an error object into
nvp_private_vacationDelegate, so every exit path from the step must clear it.
Notes:
skipPolicyInviteEmails is a new optional parameter on SetVacationDelegate (added in a separate backend issue). When true, the backend sets the delegate and sends no email to any workspace admin.
- On the "Confirm" and "Invite" paths, the backend emails one owner per missing workspace where the user is not an admin, with the other admins in cc, and only where the user is in that workspace's approval workflow. Admin workspaces never get an email.
- The invites should be sent before the final
SetVacationDelegate, and the backend recomputes the diff, so freshly workspaces invites no longer trigger the admins emails.
- The delegate always gets their own "you are now a vacation delegate" email, including on "Skip".
- Other error codes (invalid delegate, delegate on vacation, account not found) keep the existing error modal behavior.
Issue Owner
Current Issue Owner: @war-in
Part of https://github.com/Expensify/Expensify/issues/668027
Context
SetVacationDelegatewithoverridePolicyDiffWarning: falsereturns jsonCode305withdata.policyDiff = {adminPolicies, nonAdminPolicies}(two lists of policy IDs, split by whether the requester is an admin) when the delegate is missing from some workspaces. The server writes nothing on a305. NewDot ignores the data and only shows a generic confirm modal (VacationDelegatePage.tsx#L71-L88).Changes
Replace the modal with a step in the RHP that renders one of three variations:
adminPoliciesempty): explain that the admins will get an email. One button, "Confirm".nonAdminPoliciesempty): offer "Invite" and "Skip".If there is no diff, the first call sets the delegate and the step never appears. Workspace names and avatars come from the local
policy_Onyx collection.SetVacationDelegate(overridePolicyDiffWarning=true)AddMembersToWorkspaceper admin policy, thenSetVacationDelegate(overridePolicyDiffWarning=true)SetVacationDelegate(overridePolicyDiffWarning=true, skipPolicyInviteEmails=true)skipPolicyInviteEmailstoSetVacationDelegateParamsand pass it through thesetVacationDelegateaction.response.data.policyDiffinstead of discarding it.addMembersToWorkspaceaction, one call per admin policy (per the bulk-action guideline and the 1:1:1 rule), then callsSetVacationDelegate.nvp_private_vacationDelegate, so every exit path from the step must clear it.Notes:
skipPolicyInviteEmailsis a new optional parameter onSetVacationDelegate(added in a separate backend issue). When true, the backend sets the delegate and sends no email to any workspace admin.SetVacationDelegate, and the backend recomputes the diff, so freshly workspaces invites no longer trigger the admins emails.Issue Owner
Current Issue Owner: @war-in