From 1d733348bc0f51fcaf4c80118934ba0959b0fe32 Mon Sep 17 00:00:00 2001 From: Alexander Mechler Date: Thu, 13 Oct 2022 14:53:44 -0700 Subject: [PATCH 1/3] Fix policy name when creating a workspace for another user --- src/libs/actions/Policy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 2abefa28bdbd..8813d90be5b7 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -717,8 +717,8 @@ function clearDeleteWorkspaceError(policyID) { * Generate a policy name based on an email and policy list. * @returns {String} */ -function generateDefaultWorkspaceName() { - const emailParts = sessionEmail.split('@'); +function generateDefaultWorkspaceName(email = '') { + const emailParts = email ? email.split ('@') : sessionEmail.split('@'); let defaultWorkspaceName = ''; if (!emailParts || emailParts.length !== 2) { return defaultWorkspaceName; @@ -769,7 +769,7 @@ function generatePolicyID() { */ function createWorkspace(ownerEmail = '', makeMeAdmin = false) { const policyID = generatePolicyID(); - const workspaceName = generateDefaultWorkspaceName(); + const workspaceName = generateDefaultWorkspaceName(ownerEmail); const { announceChatReportID, From d4e50626f6f01a34cd5291ec314ee98fb611d2a8 Mon Sep 17 00:00:00 2001 From: Alexander Mechler Date: Thu, 13 Oct 2022 15:22:35 -0700 Subject: [PATCH 2/3] Style Fixes --- src/libs/actions/Policy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 8813d90be5b7..3fc09872657c 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -715,10 +715,12 @@ function clearDeleteWorkspaceError(policyID) { /** * Generate a policy name based on an email and policy list. + * @param {String} email Optional, the email to base the workspace name on. If not passed, will use + * the logged in user's email instead * @returns {String} */ function generateDefaultWorkspaceName(email = '') { - const emailParts = email ? email.split ('@') : sessionEmail.split('@'); + const emailParts = email ? email.split('@') : sessionEmail.split('@'); let defaultWorkspaceName = ''; if (!emailParts || emailParts.length !== 2) { return defaultWorkspaceName; From c3c003455976bb3a99b584c7ee986ba14dde423d Mon Sep 17 00:00:00 2001 From: Alexander Mechler Date: Thu, 13 Oct 2022 15:35:08 -0700 Subject: [PATCH 3/3] fix style on comment --- src/libs/actions/Policy.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 3fc09872657c..b51666f0e86f 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -715,8 +715,7 @@ function clearDeleteWorkspaceError(policyID) { /** * Generate a policy name based on an email and policy list. - * @param {String} email Optional, the email to base the workspace name on. If not passed, will use - * the logged in user's email instead + * @param {String} [email] the email to base the workspace name on. If not passed, will use the logged in user's email instead * @returns {String} */ function generateDefaultWorkspaceName(email = '') {