mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: Partial match aliases in emoji filter (#15613)
This commit is contained in:
parent
ce2c5ffb29
commit
6f8c91254e
2 changed files with 12 additions and 3 deletions
|
@ -158,4 +158,11 @@ discourseModule("Unit | Utility | emoji", function () {
|
||||||
|
|
||||||
assert.deepEqual(matches, ["bowing_man"]);
|
assert.deepEqual(matches, ["bowing_man"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("search does partial-match on emoji aliases", function (assert) {
|
||||||
|
const matches = emojiSearch("instru");
|
||||||
|
|
||||||
|
assert.ok(matches.includes("woman_teacher"));
|
||||||
|
assert.ok(matches.includes("violin"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -222,9 +222,11 @@ export function emojiSearch(term, options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchAliases[term]) {
|
for (const [key, value] of Object.entries(searchAliases)) {
|
||||||
for (const emoji of searchAliases[term]) {
|
if (key.startsWith(term)) {
|
||||||
addResult(emoji);
|
for (const emoji of value) {
|
||||||
|
addResult(emoji);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue