takahe icon indicating copy to clipboard operation
takahe copied to clipboard

Implement Emoji Reactions

Open kromonos opened this issue 2 years ago • 12 comments

Could also be from MissKey:

users-runner     | Tasks processed this loop:
users-runner     |   users.inboxmessage: 2
users-runner     | Running cleaning and scheduling
users-runner     | Attempting transition on users.inboxmessage#69809 from state received
users-runner     | Traceback (most recent call last):
users-runner     |   File "/usr/local/lib/python3.11/site-packages/asgiref/sync.py", line 486, in thread_handler
users-runner     |     raise exc_info[1]
users-runner     |   File "/takahe/stator/models.py", line 172, in atransition_attempt
users-runner     |     next_state = await current_state.handler(self)  # type: ignore
users-runner     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
users-runner     |   File "/takahe/users/models/inbox_message.py", line 120, in handle_received
users-runner     |     raise ValueError(f"Cannot handle activity of type {unknown}")
users-runner     | ValueError: Cannot handle activity of type http://litepub.social/ns#emojireact

Personally, I'm feeling a bit mixed about the function. Surely it is sometimes quite nice, but necessary? Not really. After all, there is the little star under the message. Admittedly, the emoji reaction could express other “feelings” as well, than just like.

kromonos avatar Dec 28 '22 15:12 kromonos

Oh right, emoji reactions. I'll just put in a thing to drop and ignore these for now and we'll revisit if we want to support them in future.

andrewgodwin avatar Dec 28 '22 17:12 andrewgodwin

Another option is to treat them like favorites, which is how I believe mastodon handles emojireacts from fedibird

whatSocks avatar Dec 30 '22 19:12 whatSocks

I hesitated to do that given that the emoji in the react might be negative, but if it's an established pattern...

andrewgodwin avatar Dec 30 '22 22:12 andrewgodwin

I think, a reaction is a reaction, never mind, if it's a star, or an emoji. If it's meant negative, that's ok. That's on their side, but it hasn't meant to be negative on Takahe side?

kromonos avatar Dec 30 '22 22:12 kromonos

It looks like both Misskey and Firefish are sending the type=Like object at this time. So Takahē already accepts any emoji reaction on the other server as a like reaction now.

Here's an example object sent from Firefish when I send 😇 reaction:

{
    'id': 'https://firefish.social/likes/9ik9ujpnd11k67xc',
    'type': 'Like',
    'actor': 'https://firefish.social/users/9i761tefz4uyltlz',
    'object': 'https://takahe.shuuji3.xyz/@[email protected]/posts/215037658374555952/',
    'content': '😇',
    '@context': [
        'https://www.w3.org/ns/activitystreams',
        'https://w3id.org/security/v1',
        {
            'toot': 'http://joinmastodon.org/ns#',
            'Emoji': 'toot:Emoji',
            'isCat': 'misskey:isCat',
            'value': 'schema:value',
            'vcard': 'http://www.w3.org/2006/vcard/ns#',
            'schema': 'http://schema.org#',
            'Hashtag': 'as:Hashtag',
            'misskey': 'https://misskey-hub.net/ns#',
            'featured': 'toot:featured',
            'fedibird': 'http://fedibird.com/ns#',
            'quoteUri': 'fedibird:quoteUri',
            'quoteUrl': 'as:quoteUrl',
            'sensitive': 'as:sensitive',
            'movedToUri': 'as:movedTo',
            'discoverable': 'toot:discoverable',
            'PropertyValue': 'schema:PropertyValue',
            '_misskey_talk': 'misskey:_misskey_talk',
            '_misskey_quote': 'misskey:_misskey_quote',
            '_misskey_votes': 'misskey:_misskey_votes',
            '_misskey_content':'misskey:_misskey_content',
            '_misskey_reaction': 'misskey:_misskey_reaction',
            'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers'
        },
        'https://w3id.org/security/v1'
    ],
    '_misskey_reaction': '😇'
}

On Firefish Screenshot 2023-08-19 at 0 34 47

Takahē on Elk Screenshot 2023-08-18 at 23 26 57

So this issue had already been resolved without any action...?

I agree it's a bit weird to be liked even if it's 👎🏻 reaction. But both UI shows the server icon on a user account if they use a different application with an icon, so at least users can be aware when sending a reaction to Takahē account.

shuuji3 avatar Aug 18 '23 15:08 shuuji3

This ticket was more "actually support emoji reactions" in my mind rather than merely translating them all to Likes (which is what Mastodon does anyway, so :-1: being a star is kind of expected behaviour for most servers!)

andrewgodwin avatar Aug 19 '23 00:08 andrewgodwin

Ok, I'm guessing three bits here:

  • Make sure reactions are correctly accepted and stored
  • Make sure reactions are correctly aggregated and forwarded
  • Update the UI to display reactions

AstraLuma avatar Nov 08 '23 19:11 AstraLuma

Yeah - PostInteraction is prepped to accept arbitrary reaction types, so the problem is mostly inbound and outbound comms.

The mastadon API has no way of seeing these reactions or sending them though, so I don't know how important it is (they'll only be visible on the web UI from external sources)

andrewgodwin avatar Nov 08 '23 20:11 andrewgodwin

Do we have any example activities of unreacting? Or custom emoji?

AstraLuma avatar Nov 09 '23 16:11 AstraLuma

The Iceshrimp UI suggests it only supports one reaction per user.

AstraLuma avatar Nov 09 '23 17:11 AstraLuma

Ok, some example messages (Unicode emoji reactions from iceshrimp):

{
  "id": "https://fediverse.gay/likes/9lv0n6wjz85mpu6p",
  "type": "Like",
  "actor": "https://fediverse.gay/users/9ltneg7gvuorfb2i",
  "object": "https://derez.zone/@[email protected]/posts/244939510870121776/",
  "content": "❤️",
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "toot": "http://joinmastodon.org/ns#",
      "Emoji": "toot:Emoji",
      "isCat": "misskey:isCat",
      "value": "schema:value",
      "vcard": "http://www.w3.org/2006/vcard/ns#",
      "schema": "http://schema.org#",
      "Hashtag": "as:Hashtag",
      "misskey": "https://misskey-hub.net/ns#",
      "featured": "toot:featured",
      "fedibird": "http://fedibird.com/ns#",
      "quoteUri": "fedibird:quoteUri",
      "quoteUrl": "as:quoteUrl",
      "sensitive": "as:sensitive",
      "movedToUri": "as:movedTo",
      "discoverable": "toot:discoverable",
      "PropertyValue": "schema:PropertyValue",
      "_misskey_talk": "misskey:_misskey_talk",
      "_misskey_quote": "misskey:_misskey_quote",
      "_misskey_votes": "misskey:_misskey_votes",
      "_misskey_content": "misskey:_misskey_content",
      "_misskey_reaction": "misskey:_misskey_reaction",
      "manuallyApprovesFollowers": "as:manuallyApprovesFollowers"
    },
    "https://w3id.org/security/v1"
  ],
  "_misskey_reaction": "❤️"
}
{
  "id": "https://fediverse.gay/likes/9lv0n6wjz85mpu6p/undo",
  "type": "Undo",
  "actor": "https://fediverse.gay/users/9ltneg7gvuorfb2i",
  "object": {
    "id": "https://fediverse.gay/likes/9lv0n6wjz85mpu6p",
    "type": "Like",
    "actor": "https://fediverse.gay/users/9ltneg7gvuorfb2i",
    "object": "https://derez.zone/@[email protected]/posts/244939510870121776/",
    "content": "❤️",
    "_misskey_reaction": "❤️"
  },
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "toot": "http://joinmastodon.org/ns#",
      "Emoji": "toot:Emoji",
      "isCat": "misskey:isCat",
      "value": "schema:value",
      "vcard": "http://www.w3.org/2006/vcard/ns#",
      "schema": "http://schema.org#",
      "Hashtag": "as:Hashtag",
      "misskey": "https://misskey-hub.net/ns#",
      "featured": "toot:featured",
      "fedibird": "http://fedibird.com/ns#",
      "quoteUri": "fedibird:quoteUri",
      "quoteUrl": "as:quoteUrl",
      "sensitive": "as:sensitive",
      "movedToUri": "as:movedTo",
      "discoverable": "toot:discoverable",
      "PropertyValue": "schema:PropertyValue",
      "_misskey_talk": "misskey:_misskey_talk",
      "_misskey_quote": "misskey:_misskey_quote",
      "_misskey_votes": "misskey:_misskey_votes",
      "_misskey_content": "misskey:_misskey_content",
      "_misskey_reaction": "misskey:_misskey_reaction",
      "manuallyApprovesFollowers": "as:manuallyApprovesFollowers"
    },
    "https://w3id.org/security/v1"
  ],
  "published": "2023-11-09T17:17:56.420Z"
}

I can't actually get the Iceshrimp UI to change a reaction without removing the old one, and I'm unfamiliar with the Misskey client ecosystem. (Using fediverse.gay because firefish.social is being kinda laggy in a not-confidence-inspiring way.)

AstraLuma avatar Nov 09 '23 17:11 AstraLuma

Calling this "Emoji" Reaction might be a misnomer. The reaction content can be any text, with (misskey extension) emoji replacement.

iacore avatar Dec 13 '23 14:12 iacore