FIX: Do not skip some emails in user search (#8317)

It used to skip the email addresses containing the plus sign.
This commit is contained in:
Dan Ungureanu 2019-11-11 18:42:45 +02:00 committed by GitHub
parent 6672dcc985
commit 55bdd9e6a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -136,7 +136,7 @@ function organizeResults(r, options) {
// will not find me, which is a reasonable compromise
//
// we also ignore if we notice a double space or a string that is only a space
const ignoreRegex = /([\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\/:;<=>?\[\]^`{|}~])|\s\s|^\s$/;
const ignoreRegex = /([\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*,\/:;<=>?\[\]^`{|}~])|\s\s|^\s$|^[^+]*\+[^@]*$/;
function skipSearch(term, allowEmails) {
if (term.indexOf("@") > -1 && !allowEmails) {

View File

@ -169,6 +169,9 @@ QUnit.test("it skips a search depending on punctuations", async assert => {
// 6 + email
assert.equal(results.length, 7);
results = await userSearch({ term: "sam+test@sam.com", allowEmails: true });
assert.equal(results.length, 7);
results = await userSearch({ term: "sam@sam.com" });
assert.equal(results.length, 0);