diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index 265de152b3d5..653bfa751268 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -187,12 +187,14 @@ function setUpPoliciesAndNavigate(session) { const isLoggingInAsNewUser = SessionUtils.isLoggingInAsNewUser(currentUrl, session.email); const url = new URL(currentUrl); const exitTo = url.searchParams.get('exitTo'); + const ownerEmail = url.searchParams.get('ownerEmail'); + const makeMeAdmin = url.searchParams.get('makeMeAdmin'); const shouldCreateFreePolicy = !isLoggingInAsNewUser && Str.startsWith(url.pathname, Str.normalizeUrl(ROUTES.TRANSITION_FROM_OLD_DOT)) && exitTo === ROUTES.WORKSPACE_NEW; if (shouldCreateFreePolicy) { - Policy.createWorkspace(); + Policy.createWorkspace(ownerEmail, makeMeAdmin); return; } if (!isLoggingInAsNewUser && exitTo) { diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 457f3e2cd4e1..f3ef5276bb4b 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -764,7 +764,7 @@ function generatePolicyID() { /** * Optimistically creates a new workspace and default workspace chats */ -function createWorkspace() { +function createWorkspace(ownerEmail = '', makeMeAdmin = false) { const policyID = generatePolicyID(); const workspaceName = generateDefaultWorkspaceName(); @@ -785,6 +785,8 @@ function createWorkspace() { announceChatReportID, adminsChatReportID, expenseChatReportID, + ownerEmail, + makeMeAdmin, policyName: workspaceName, type: CONST.POLICY.TYPE.FREE, },