Transmogrifier: Keep likes as likes if the content is obviously wrong

This commit is contained in:
Lain Soykaf 2025-03-19 16:00:27 +04:00
commit f9bff8f5e5
2 changed files with 5 additions and 3 deletions

View file

@ -495,10 +495,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
defp handle_incoming_normalized( defp handle_incoming_normalized(
%{ %{
"type" => "Like", "type" => "Like",
"content" => _ "content" => content
} = data, } = data,
options options
) do )
when is_binary(content) do
data data
|> Map.put("type", "EmojiReact") |> Map.put("type", "EmojiReact")
|> handle_incoming_normalized(options) |> handle_incoming_normalized(options)

View file

@ -140,6 +140,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.LikeHandlingTest do
_actor = insert(:user, ap_id: data["actor"], local: false) _actor = insert(:user, ap_id: data["actor"], local: false)
assert {:error, _} = Transmogrifier.handle_incoming(data) assert {:ok, activity} = Transmogrifier.handle_incoming(data)
assert activity.data["type"] == "Like"
end end
end end