mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Strip @ when searching for users and groups. (#6506)
This commit is contained in:
parent
f0af61da41
commit
22ada32d4d
@ -109,6 +109,10 @@ function organizeResults(r, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function userSearch(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 || "",
|
var term = options.term || "",
|
||||||
includeGroups = options.includeGroups,
|
includeGroups = options.includeGroups,
|
||||||
includeMentionableGroups = options.includeMentionableGroups,
|
includeMentionableGroups = options.includeMentionableGroups,
|
||||||
|
@ -66,3 +66,8 @@ QUnit.test("it places groups unconditionally for exact match", async assert => {
|
|||||||
let results = await userSearch({ term: "Team" });
|
let results = await userSearch({ term: "Team" });
|
||||||
assert.equal(results[results.length - 1]["name"], "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");
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user