From 9dea1d0352d808c39a669233d7a71e091273c062 Mon Sep 17 00:00:00 2001 From: Joe Gambino Date: Tue, 4 May 2021 12:46:05 -0700 Subject: [PATCH 1/2] Don't allow users to create chats with domain accounts --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index a10144982bfa..90b82a3ac1b3 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -287,7 +287,7 @@ function getOptions(reports, personalDetails, draftComments, activeReportID, { && recentReportOptions.length === 0 && personalDetailsOptions.length === 0 && _.every(selectedOptions, option => option.login !== searchValue) - && (Str.isValidEmail(searchValue) || Str.isValidPhone(searchValue)) + && ((Str.isValidEmail(searchValue) && !Str.startsWith(searchValue, '+@')) || Str.isValidPhone(searchValue)) && (searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos()) ) { // If the phone number doesn't have an international code then let's prefix it with the From d5a8e30f3ccefe9f9d3090837442909e2c7668b0 Mon Sep 17 00:00:00 2001 From: Joe Gambino Date: Thu, 6 May 2021 17:27:21 -0700 Subject: [PATCH 2/2] update common, use new str lib --- package-lock.json | 4 ++-- package.json | 2 +- src/libs/OptionsListUtils.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 49bc49853eb9..aeae437955a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11562,8 +11562,8 @@ } }, "expensify-common": { - "version": "git+https://github.com/Expensify/expensify-common.git#d5edd0a956ef5c12fb6e9493d1f4608289f82a0e", - "from": "git+https://github.com/Expensify/expensify-common.git#d5edd0a956ef5c12fb6e9493d1f4608289f82a0e", + "version": "git+https://github.com/Expensify/expensify-common.git#05b8a007e9faa8e3b7a1ddd7348503acca6f4e95", + "from": "git+https://github.com/Expensify/expensify-common.git#05b8a007e9faa8e3b7a1ddd7348503acca6f4e95", "requires": { "classnames": "2.2.5", "clipboard": "2.0.4", diff --git a/package.json b/package.json index b527315111ce..b3c85390b4e1 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "electron-log": "^4.2.4", "electron-serve": "^1.0.0", "electron-updater": "^4.3.4", - "expensify-common": "git+https://github.com/Expensify/expensify-common.git#d5edd0a956ef5c12fb6e9493d1f4608289f82a0e", + "expensify-common": "git+https://github.com/Expensify/expensify-common.git#05b8a007e9faa8e3b7a1ddd7348503acca6f4e95", "file-loader": "^6.0.0", "html-entities": "^1.3.1", "lodash": "4.17.21", diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 90b82a3ac1b3..d38acd01036c 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -287,7 +287,7 @@ function getOptions(reports, personalDetails, draftComments, activeReportID, { && recentReportOptions.length === 0 && personalDetailsOptions.length === 0 && _.every(selectedOptions, option => option.login !== searchValue) - && ((Str.isValidEmail(searchValue) && !Str.startsWith(searchValue, '+@')) || Str.isValidPhone(searchValue)) + && ((Str.isValidEmail(searchValue) && !Str.isDomainEmail(searchValue)) || Str.isValidPhone(searchValue)) && (searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos()) ) { // If the phone number doesn't have an international code then let's prefix it with the