Skip to content

[Vacation Delegate Invite] [FE] Replace the policy diff warning modal with an invite step page in the RHP #99078

Description

@rayane-d

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:

  1. Admin of none (adminPolicies empty): explain that the admins will get an email. One button, "Confirm".
  2. Admin of all (nonAdminPolicies empty): offer "Invite" and "Skip".
  3. 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.

Image
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 OwnerCurrent Issue Owner: @war-in

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

DailyKSv2InternalRequires API changes or must be handled by Expensify staffOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions