emojis: Prioritise custom / realm emojis when sorting.

Fixes: #18135.
This commit is contained in:
N-Shar-ma
2023-01-13 22:20:05 +05:30
committed by Tim Abbott
parent 249f482b06
commit aa72b51bca
2 changed files with 20 additions and 2 deletions

View File

@@ -153,10 +153,17 @@ export function sort_emojis(objs, query) {
const triage_results = triage(query, others, (x) => x.emoji_name);
function prioritise_realm_emojis(emojis) {
return [
...emojis.filter((emoji) => emoji.is_realm_emoji),
...emojis.filter((emoji) => !emoji.is_realm_emoji),
];
}
const sorted_results_with_possible_duplicates = [
...popular_emoji_matches,
...triage_results.matches,
...triage_results.rest,
...prioritise_realm_emojis(triage_results.matches),
...prioritise_realm_emojis(triage_results.rest),
];
// remove unicode emojis with same code but different names
const unicode_emoji_codes = new Set();