fix(activitypub): accept emoji reactions with a single tag object
Ported from Akkoma 462225880. Co-authored-by: Oneric <oneric@oneric.stub>
This commit is contained in:
parent
3e9dc477c9
commit
654a41b2c9
3 changed files with 31 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactValidator do
|
|||
|> CommonFixes.fix_actor()
|
||||
|> CommonFixes.fix_activity_addressing()
|
||||
|
||||
data = Map.put_new(data, "tag", [])
|
||||
data = fix_tag(data)
|
||||
|
||||
case Object.normalize(data["object"]) do
|
||||
%Object{} = object ->
|
||||
|
|
@ -70,6 +70,10 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactValidator do
|
|||
end
|
||||
end
|
||||
|
||||
# JSON-LD compaction turns a single-element array into a bare object
|
||||
defp fix_tag(%{"tag" => %{} = tag} = data), do: Map.put(data, "tag", [tag])
|
||||
defp fix_tag(data), do: Map.put_new(data, "tag", [])
|
||||
|
||||
defp fix_emoji_qualification(%{"content" => emoji} = data) do
|
||||
new_emoji = Pleroma.Emoji.fully_qualify_emoji(emoji)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue