mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Partial match aliases in emoji filter (#15613)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user