Follow-up to the audit in issue 72980.
Problem
On the legacy travel request-access path — BookTravelButton.tsx:169-172, reached when BETAS.IS_TRAVEL_VERIFIED is off — the validated branch does two things: it calls requestTravelAccess() and, when shouldShowVerifyAccountModal is true, it shows the "verify company" confirm modal.
After the magic code, only the first of those happens. Travel/VerifyAccountPage.tsx:36 sets the forward route to undefined on that branch:
const navigateForwardTo = isTravelVerifiedBetaEnabled ? (travelProvisioning?.nextStepRoute ?? defaultForwardRoute) : undefined;
requestTravelAccess() does fire through onValidationSuccess, but the confirm modal is skipped and the user is sent back with no feedback. This is a partial continuation rather than a full stop, so it is lower impact than the other flow-stops in the audit.
Solution
Make the legacy branch reproduce the whole validated branch, confirm modal included. The cleanest way is useVerifyAccountAndResume (src/hooks/useVerifyAccountAndResume.ts) in BookTravelButton, so one code path serves both the validated and the just-validated user.
Action Items
- Hook the resume: call
useVerifyAccountAndResume in BookTravelButton.tsx for the legacy branch.
- Resume the full branch: on resume, run
requestTravelAccess() and the shouldShowVerifyAccountModal confirm modal, matching lines 173-186.
- Simplify the verify page: once the resume covers it, drop the now-unused
onValidationSuccess and handleClose overrides from Travel/VerifyAccountPage.tsx.
- Do not regress the beta-on path: with
IS_TRAVEL_VERIFIED enabled the forward route comes from travelProvisioning?.nextStepRoute and already works. Leave it alone.
- Verify: with the beta off and an unvalidated account on an unprovisioned paid workspace, press Book travel, enter the magic code, and confirm the confirm modal appears just as it does for a validated user.
Specific Component to Migrate
BookTravelButton legacy request-access path
- Current files:
src/components/BookTravelButton.tsx, src/pages/Travel/VerifyAccountPage.tsx
- Reuse:
src/hooks/useVerifyAccountAndResume.ts
Issue Owner
Current Issue Owner: @aimane-chnaif
Follow-up to the audit in issue 72980.
Problem
On the legacy travel request-access path — BookTravelButton.tsx:169-172, reached when
BETAS.IS_TRAVEL_VERIFIEDis off — the validated branch does two things: it callsrequestTravelAccess()and, whenshouldShowVerifyAccountModalis true, it shows the "verify company" confirm modal.After the magic code, only the first of those happens. Travel/VerifyAccountPage.tsx:36 sets the forward route to
undefinedon that branch:requestTravelAccess()does fire throughonValidationSuccess, but the confirm modal is skipped and the user is sent back with no feedback. This is a partial continuation rather than a full stop, so it is lower impact than the other flow-stops in the audit.Solution
Make the legacy branch reproduce the whole validated branch, confirm modal included. The cleanest way is
useVerifyAccountAndResume(src/hooks/useVerifyAccountAndResume.ts) inBookTravelButton, so one code path serves both the validated and the just-validated user.Action Items
useVerifyAccountAndResumein BookTravelButton.tsx for the legacy branch.requestTravelAccess()and theshouldShowVerifyAccountModalconfirm modal, matching lines 173-186.onValidationSuccessandhandleCloseoverrides from Travel/VerifyAccountPage.tsx.IS_TRAVEL_VERIFIEDenabled the forward route comes fromtravelProvisioning?.nextStepRouteand already works. Leave it alone.Specific Component to Migrate
BookTravelButtonlegacy request-access pathsrc/components/BookTravelButton.tsx,src/pages/Travel/VerifyAccountPage.tsxsrc/hooks/useVerifyAccountAndResume.tsIssue Owner
Current Issue Owner: @aimane-chnaif