Skip to content

Commit

Permalink
wip prioritize :zulip: same as realm emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Dec 7, 2024
1 parent fcc5f06 commit 55390d3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/model/emoji.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,18 @@ class EmojiAutocompleteView extends AutocompleteView<EmojiAutocompleteQuery, Emo
}
final candidate = result.candidate;
final isPopular = _isPopularEmoji(candidate);
final isRealmEmoji = (candidate.emojiType == ReactionType.realmEmoji);
final isCustomEmoji = switch (candidate.emojiType) {
// The web implementation calls this condition `is_realm_emoji`,
// but its actual semantics is it's true for the Zulip extra emoji too.
// See `zulip_emoji` in web:src/emoji.ts .
ReactionType.realmEmoji || ReactionType.zulipExtraEmoji => true,
ReactionType.unicodeEmoji => false,
};
return switch (result.matchQuality) {
EmojiMatchQuality.exact => throw Error(), // handled above
EmojiMatchQuality.prefix => isPopular ? 1 : isRealmEmoji ? 3 : 4,
EmojiMatchQuality.prefix => isPopular ? 1 : isCustomEmoji ? 3 : 4,
// TODO word-boundary vs. not
EmojiMatchQuality.internal => isPopular ? 2 : isRealmEmoji ? 5 : 6,
EmojiMatchQuality.internal => isPopular ? 2 : isCustomEmoji ? 5 : 6,
};
}

Expand Down

0 comments on commit 55390d3

Please sign in to comment.