REFACTOR: remove disallowEmails option from user-selector

Negative option was leading to a fair amount of confusion, going forward
if we want to allow selection of emails from user selector it must be
supplied with `allowEmails=true`

This corrects a regression in 1f4ace4f which broke invite by emails and
start PM to email
This commit is contained in:
Sam
2019-02-21 16:23:11 +11:00
parent 79841cf7dd
commit 07b856700d
6 changed files with 23 additions and 10 deletions

View File

@ -73,6 +73,7 @@ QUnit.test("it strips @ from the beginning", async assert => {
});
QUnit.test("it skips a search depending on punctuations", async assert => {
let results;
let skippedTerms = [
"@sam s", // double space is not allowed
"@sam;",
@ -81,7 +82,7 @@ QUnit.test("it skips a search depending on punctuations", async assert => {
];
for (let term of skippedTerms) {
let results = await userSearch({ term });
results = await userSearch({ term });
assert.equal(results.length, 0);
}
@ -94,7 +95,14 @@ QUnit.test("it skips a search depending on punctuations", async assert => {
let topicId = 100;
for (let term of allowedTerms) {
let results = await userSearch({ term, topicId });
results = await userSearch({ term, topicId });
assert.equal(results.length, 6);
}
results = await userSearch({ term: "sam@sam.com", allowEmails: true });
// 6 + email
assert.equal(results.length, 7);
results = await userSearch({ term: "sam@sam.com" });
assert.equal(results.length, 0);
});