Skip to content

Commit

Permalink
emoji_picker: Improve emoji picker search results.
Browse files Browse the repository at this point in the history
This sorts the emoji picker's search results using the same
`typehead.sort_emojis` function as the compose typehead.

Resolves #15694.
  • Loading branch information
vinitS101 authored and timabbott committed Jul 8, 2020
1 parent 6e5fb85 commit 8b54cce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions static/js/emoji_picker.js
Expand Up @@ -212,15 +212,16 @@ function filter_emojis() {
for (const alias of emoji_dict.aliases) {
const match = search_terms.every((search_term) => alias.includes(search_term));
if (match) {
search_results.push({ ...emoji_dict, name: alias });
search_results.push({ ...emoji_dict, emoji_name: alias });
break; // We only need the first matching alias per emoji.
}
}
}
}

const sorted_search_results = typeahead.sort_emojis(search_results, query);
const rendered_search_results = render_emoji_popover_search_results({
search_results: search_results,
search_results: sorted_search_results,
message_id: message_id,
});
$('.emoji-search-results').html(rendered_search_results);
Expand Down

0 comments on commit 8b54cce

Please sign in to comment.