Skip to content

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Sep 16, 2025

@Johennes Johennes changed the title MSCXXXX: Recently used emoji MSC4356: Recently used emoji Sep 16, 2025
Signed-off-by: Johannes Marbach <[email protected]>
@Johennes Johennes force-pushed the johannes/recent-emoji branch from a5ff1ba to ad61e4f Compare September 16, 2025 10:44
@Johennes Johennes marked this pull request as ready for review September 16, 2025 10:45
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff labels Sep 16, 2025

## Proposal

A new global account data event `m.recent_emoji` is introduced. In `content`, it contains a single
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that the plural form of emoji can be emoji but to avoid confusion, maybe using m.recent_emojis help to clarify that we have a list of emojis?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client developers should be able to determine the type of a field from the spec, rather than relying on the field name.

As a native English speaker, recent_emoji sounds best to me.

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up! 😁


## Proposal

A new global account data event `m.recent_emoji` is introduced. In `content`, it contains a single
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client developers should be able to determine the type of a field from the spec, rather than relying on the field name.

As a native English speaker, recent_emoji sounds best to me.

Comment on lines 56 to 57
Further metadata such as the concrete access time or the room could be tracked together with emoji.
It is unclear, however, if this would lead to materially better suggestions, however.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One alternative would be to structure m.recent_emoji as the following:

"recent_emoji": {
  "😅": {
    "last_used": 10000000,
    "count": 7
  },
  "👍": {
    "last_used": 20000000,
    "count": 84
  }
}

where e.g. 10000000 is a unix timestamp of the last time the emoji was used.

  • A dict would allow a client to access the attributes of a given emoji more efficiently than an array.
  • Documenting when the emoji was last used can be helpful. If it wasn't used for a long time, a client could drop the emoji from the list; even if it had been used many, many times in the past.

To save bandwidth, this could instead be represented as:

"recent_emoji": {
  "😅": [10000000, 7],
  "👍": [20000000, 84]
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting to add this to the (discarded) alternatives or to use this instead of the current scheme? At the moment, this proposal simply captures what some of Element's clients had implemented previously.

I personally like using objects for the emoji properties, as in your variant, because that makes the semantics of the different values more explicit. I suspect that with request compression, it should have a negligible impact on bandwidth.

For the outer structure, an array, as in the current proposal text, would have the benefit that it automatically stays ordered by last usage time. Then again, the set of tracked emoji will probably be relatively small. So this optimization might be superfluous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To illustrate what this change would mean for the current implementations: Element Web currently generates suggestions by taking the first 24 array elements (meaning the 24 most recently used emoji), then stably sorts that list by usage count.

With the alternative suggested above, this logic would require a sort of the entire set by last_used, truncating the result at a length of 24, then stably sorting the remainder by count.

Also for illustration: My own io.element.recent_emoji event currently contains 52 elements only (Element Web allows for up to 100). If this is representative, any performance considerations might be moot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants