FEATURE: Partial match aliases in emoji filter (#15613)
This commit is contained in:
parent
ce2c5ffb29
commit
6f8c91254e
|
@ -158,4 +158,11 @@ discourseModule("Unit | Utility | emoji", function () {
|
|||
|
||||
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 emoji of searchAliases[term]) {
|
||||
addResult(emoji);
|
||||
for (const [key, value] of Object.entries(searchAliases)) {
|
||||
if (key.startsWith(term)) {
|
||||
for (const emoji of value) {
|
||||
addResult(emoji);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue