diff options
author | lain <lain@soykaf.club> | 2019-10-07 07:25:27 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-10-07 07:25:27 +0000 |
commit | 91e90aa807c2ce346cd453201447806fb71b21fe (patch) | |
tree | 65943118ca0dc28c4fd181e51e8166f76d90ff91 /lib | |
parent | 61097ba6ab1f40f8a885f1adc96455b3c82cfd9b (diff) | |
parent | 6a85f7d1eabd957588a2f9b8dfea5b7f982573be (diff) | |
download | pleroma-91e90aa807c2ce346cd453201447806fb71b21fe.tar.gz |
Merge branch 'misskey-compat' into 'reactions'
Transmogrifier: Handle misskey likes with reactions like EmojiReactions.
See merge request pleroma/pleroma!1783
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 05a03a377..2c1f01c18 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -560,6 +560,34 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end end + @misskey_reactions %{ + "like" => "👍", + "love" => "❤️", + "laugh" => "😆", + "hmm" => "🤔", + "surprise" => "😮", + "congrats" => "🎉", + "angry" => "💢", + "confused" => "😥", + "rip" => "😇", + "pudding" => "🍮", + "star" => "⭐" + } + + @doc "Rewrite misskey likes into EmojiReactions" + def handle_incoming( + %{ + "type" => "Like", + "_misskey_reaction" => reaction + } = data, + options + ) do + data + |> Map.put("type", "EmojiReaction") + |> Map.put("content", @misskey_reactions[reaction] || reaction) + |> handle_incoming(options) + end + def handle_incoming( %{"type" => "Like", "object" => object_id, "actor" => _actor, "id" => id} = data, _options |