-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Performance issue when using api to create users (#29914)
Co-authored-by: Guilherme Gazzo <[email protected]> Co-authored-by: Kevin Aleman <[email protected]>
- Loading branch information
1 parent
f0362b5
commit 6437cdf
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
fix: Performance issue when using api to create users |
5 changes: 1 addition & 4 deletions
5
apps/meteor/app/lib/server/functions/checkEmailAvailability.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import { escapeRegExp } from '@rocket.chat/string-helpers'; | ||
import { Users } from '@rocket.chat/models'; | ||
|
||
export const checkEmailAvailability = async function (email: string): Promise<boolean> { | ||
return !(await Users.findOne({ | ||
'emails.address': { $regex: new RegExp(`^${escapeRegExp(email).trim()}$`, 'i') }, | ||
})); | ||
return !(await Users.findOneByEmailAddress(email)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters