Merge branch 'misskey-compat' into 'reactions'

Transmogrifier: Handle misskey likes with reactions like EmojiReactions.

See merge request pleroma/pleroma!1783
This commit is contained in:
lain 2019-10-07 07:25:27 +00:00
commit 91e90aa807
3 changed files with 79 additions and 0 deletions

View file

@ -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