Skip to content

Commit 489a699

Browse files
gnpricechrisbobbe
authored andcommitted
emoji [nfc]: Compare emoji base ordering with web's, in detail
I spent some time reverse-engineering in full detail the behavior web has for building its list of possible emoji to present in the UI (and so for the order that emoji results have when they don't differ on any of the criteria used at the ranking step after applying a query). The first output of that study was discovering #1113, fixed earlier in this branch. This records the rest.
1 parent 661fa53 commit 489a699

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

lib/model/emoji.dart

+34-2
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,39 @@ class EmojiStoreImpl with EmojiStore {
222222
}
223223

224224
List<EmojiCandidate> _generateAllCandidates() {
225+
// Compare `emoji_picker.rebuild_catalog` in Zulip web;
226+
// `composebox_typeahead.update_emoji_data` which receives its output;
227+
// and `emoji.update_emojis` which builds part of its input.
228+
// https://github.com/zulip/zulip/blob/0f59e2e78/web/src/emoji_picker.ts#L132-L185
229+
// https://github.com/zulip/zulip/blob/0f59e2e78/web/src/composebox_typeahead.ts#L138-L163
230+
// https://github.com/zulip/zulip/blob/0f59e2e78/web/src/emoji.ts#L232-L278
231+
//
232+
// Behavior differences we might copy or change, TODO:
233+
// * Web has a particular ordering of Unicode emoji;
234+
// a data file groups them by category and orders within each of those,
235+
// and the code has a list of categories.
236+
// This seems useful; it'll call for expanding the server emoji data API.
237+
// * Both here and in web, the realm emoji appear in whatever order the
238+
// server returned them in; and that order appears to be random,
239+
// presumably the iteration order of some Python dict,
240+
// and to vary over time.
241+
//
242+
// Behavior differences that web should probably fix, TODO(web):
243+
// * Web ranks the realm's custom emoji (and the Zulip extra emoji) at the
244+
// end of the base list, as seen in the emoji picker on an empty query;
245+
// but then ranks them first, after only the six "popular" emoji,
246+
// once there's a non-empty query.
247+
// * Web gives the six "popular" emoji a set order amongst themselves,
248+
// like we do after #1112; but in web, this order appears only in the
249+
// emoji picker on an empty query, and is otherwise lost even when the
250+
// emoji are taken out of their home categories and shown instead
251+
// together at the front.
252+
//
253+
// In web on an empty query, :+1: aka :like: comes first, and
254+
// :heart: aka :love: comes later (fourth); but then on the query "l",
255+
// the results begin with :love: and then :like:. They've flipped order,
256+
// even though they're equally good prefix matches to the query.
257+
225258
final results = <EmojiCandidate>[];
226259

227260
final namesOverridden = {
@@ -252,8 +285,7 @@ class EmojiStoreImpl with EmojiStore {
252285
for (final emoji in activeRealmEmoji) {
253286
final emojiName = emoji.name;
254287
if (emojiName == 'zulip') {
255-
// TODO does 'zulip' really override realm emoji?
256-
// (This is copied from zulip-mobile's behavior.)
288+
// :zulip: overrides realm emoji; compare web's `emoji.update_emojis`.
257289
continue;
258290
}
259291
results.add(_emojiCandidateFor(

0 commit comments

Comments
 (0)