mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
sort_emojis: Prioritize perfect matches above all.
Currently we prioritize (even partial) realm emojis above all. Including over perfect matches if the emoji is **not** a realm emoji. The commit changes this behavior to prioritize perfect matches above all, regardless of emoji category. close https://github.com/zulip/zulip/issues/27545
This commit is contained in:
@@ -237,8 +237,18 @@ run_test("sort_emojis: prioritise realm emojis", () => {
|
||||
reaction_type: "realm_emoji",
|
||||
},
|
||||
];
|
||||
assert.deepEqual(typeahead.sort_emojis(emoji_list, "thank you"), [
|
||||
emoji_list[1],
|
||||
emoji_list[0],
|
||||
]);
|
||||
assert.deepEqual(typeahead.sort_emojis(emoji_list, "thank"), [emoji_list[1], emoji_list[0]]);
|
||||
});
|
||||
|
||||
run_test("sort_emojis: prioritise perfect matches", () => {
|
||||
const emoji_list = [
|
||||
{emoji_name: "thank_you", emoji_code: "1f64f", reaction_type: "unicode_emoji"},
|
||||
{
|
||||
emoji_name: "thank_you_custom",
|
||||
url: "something",
|
||||
is_realm_emoji: true,
|
||||
reaction_type: "realm_emoji",
|
||||
},
|
||||
];
|
||||
assert.deepEqual(typeahead.sort_emojis(emoji_list, "thank you"), emoji_list);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user