Skip to content

Emoji Reactions Final Steps

NEW THOUGHTS SINCE ~06/02/2020

By now we have a working Emoji reaction system. There are a few things to wrap up.

Backend

As pointed out by misskey people at https://github.com/syuilo/misskey/issues/5425, the choice of EmojiReaction seems weird, as noun types usually get created by a Create activity, while verbs usually act on nouns, which EmojiReaction does. Of course, in english many nouns are verbs and vice versa. Either way, I'll create an MR that changes EmojiReaction to EmojiReact to make it clearer.

Frontend

Mastodon implemented local reaction system for their admin announcements. The endpoints there are as follows:

Adding a reaction

PUT /api/v1/announcements/:id/reactions/:emoji

Removing a reaction

DELETE /api/v1/announcements/:id/reactions/:emoji

JSON representation

{
  // ...
  reactions: [
    { name: '👍', count: 123, me: false },
    { name: 'coolCat', count: 456, me: false, url: 'https://example.com/coolcat.png', static_url: 'https://example.com/coolcat.png' }, },
  ],
  // ...
}

The attribute me is true when the authenticated user has added that reaction. The attributes url and static_url are present for custom emojis.

I'll align our own api with this format to make it easier for clients to support this in the future.

OLD INFORMATION, DEPRECATED

Backend issue: pleroma!1662 (merged)

This makes it possible to 'react' to a post with a single character unicode emoji. This adds a new object type called EmojiReaction. It looks pretty much like a Like, except it also has a content property.

'Single characters' in this context means anything that will be displayed as a single glyph. Combined sequences like 👩‍👩‍👧 are valid.

NOTE: The current implementation in Pleroma will not accept sequences.

I decided against overloading Likes because they really are semantically different. Just as one aspect, there are a lot of 'negative' Emoji that should not be treated as a like.

A frontend could still decide to display the reaction and like count in a combined way and only differentiate on expanding a post.

No frontend issue yet.

The full type is litepub:EmojiReaction

An example reaction activity:

{
  "@context": [
    {
      "litepub": "http://litepub.social/ns#",
      "EmojiReaction": "litepub:EmojiReaction"
    }
  ],
  "type": "EmojiReaction",
  "id": "https://example.com/activities/1",
  "object": "https://example.com/posts/1",
  "actor": "https://example.com/users/1",
  "content": "😀"
}
Edited by lain