FIX: Strip @ when searching for users and groups. (#6506)

This commit is contained in:
Bianca Nenciu 2018-10-19 03:56:10 +03:00 committed by Sam
parent f0af61da41
commit 22ada32d4d
2 changed files with 9 additions and 0 deletions

View File

@ -109,6 +109,10 @@ function organizeResults(r, options) {
}
export default function userSearch(options) {
if (options.term && options.term.length > 0 && options.term[0] === "@") {
options.term = options.term.substring(1);
}
var term = options.term || "",
includeGroups = options.includeGroups,
includeMentionableGroups = options.includeMentionableGroups,

View File

@ -66,3 +66,8 @@ QUnit.test("it places groups unconditionally for exact match", async assert => {
let results = await userSearch({ term: "Team" });
assert.equal(results[results.length - 1]["name"], "team");
});
QUnit.test("it strips @ from the beginning", async assert => {
let results = await userSearch({ term: "@Team" });
assert.equal(results[results.length - 1]["name"], "team");
});