mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
emoji: Prefix sort for emojis.
Emoji prefix sort for "popular emojis first". Fixes #7625.
This commit is contained in:
committed by
Tim Abbott
parent
59f5af6b62
commit
955d03b8a0
@@ -254,6 +254,22 @@ exports.prefix_sort = function (query, objs, get_item) {
|
||||
rest: noMatch };
|
||||
};
|
||||
|
||||
// manipulate prefix_sort to select popular emojis first
|
||||
// This is kinda a hack and so probably not our long-term solution.
|
||||
exports.emoji_prefix_sort = function (query, objs, get_item) {
|
||||
var prefix_sort = exports.prefix_sort(query, objs, get_item);
|
||||
var popular_emoji_matches = [];
|
||||
var other_emoji_matches = [];
|
||||
prefix_sort.matches.forEach(function (obj) {
|
||||
if (emoji_picker.frequently_used_emojis_list.includes(obj.codepoint)) {
|
||||
popular_emoji_matches.push(obj);
|
||||
} else {
|
||||
other_emoji_matches.push(obj);
|
||||
}
|
||||
});
|
||||
return { matches: popular_emoji_matches.concat(other_emoji_matches), rest: prefix_sort.rest };
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user