mirror of https://github.com/zulip/zulip.git
refactor: Use Set for popular emojis.
This commit is contained in:
parent
345fcd3a69
commit
a87798bb8e
|
@ -147,6 +147,8 @@ exports.triage = function (query, objs, get_item) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.sort_emojis = function (objs, query) {
|
exports.sort_emojis = function (objs, query) {
|
||||||
|
const popular_set = new Set(exports.popular_emojis);
|
||||||
|
|
||||||
const triage_results = exports.triage(
|
const triage_results = exports.triage(
|
||||||
query,
|
query,
|
||||||
objs,
|
objs,
|
||||||
|
@ -157,7 +159,7 @@ exports.sort_emojis = function (objs, query) {
|
||||||
const other_emoji_matches = [];
|
const other_emoji_matches = [];
|
||||||
|
|
||||||
for (const obj of triage_results.matches) {
|
for (const obj of triage_results.matches) {
|
||||||
if (exports.popular_emojis.indexOf(obj.emoji_code) !== -1) {
|
if (popular_set.has(obj.emoji_code)) {
|
||||||
popular_emoji_matches.push(obj);
|
popular_emoji_matches.push(obj);
|
||||||
} else {
|
} else {
|
||||||
other_emoji_matches.push(obj);
|
other_emoji_matches.push(obj);
|
||||||
|
|
Loading…
Reference in New Issue