FIX: Correct error when sending PM to email address

This commit is contained in:
David Taylor 2019-10-28 18:32:13 +00:00
parent 918bb76f76
commit 071a82efe3
2 changed files with 13 additions and 3 deletions

View File

@ -54,9 +54,9 @@ function performSearch(
oldSearch
.then(function(r) {
const hasResults = !!(
r.users.length ||
r.groups.length ||
r.emails.length
(r.users && r.users.length) ||
(r.groups && r.groups.length) ||
(r.emails && r.emails.length)
);
if (eagerComplete && !hasResults) {

View File

@ -27,6 +27,10 @@ QUnit.module("lib:user-search", {
]});
}
if(request.url.match(/no-results/)){
return response({users: []});
}
return response({
users: [
{
@ -167,4 +171,10 @@ QUnit.test("it skips a search depending on punctuations", async assert => {
results = await userSearch({ term: "sam@sam.com" });
assert.equal(results.length, 0);
results = await userSearch({
term: "no-results@example.com",
allowEmails: true
});
assert.equal(results.length, 1);
});