activitypub transmogrifier: fix handling of contentMap.
This commit is contained in:
parent
25946f772d
commit
c95941e64d
1 changed files with 12 additions and 0 deletions
|
@ -24,6 +24,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
|> fix_in_reply_to
|
|> fix_in_reply_to
|
||||||
|> fix_emoji
|
|> fix_emoji
|
||||||
|> fix_tag
|
|> fix_tag
|
||||||
|
|> fix_content_map
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_in_reply_to(%{"inReplyTo" => in_reply_to_id} = object)
|
def fix_in_reply_to(%{"inReplyTo" => in_reply_to_id} = object)
|
||||||
|
@ -107,6 +108,17 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
|> Map.put("tag", combined)
|
|> Map.put("tag", combined)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# content map usually only has one language so this will do for now.
|
||||||
|
def fix_content_map(%{"contentMap" => content_map} = object) do
|
||||||
|
content_groups = Map.to_list(content_map)
|
||||||
|
{_, content} = Enum.at(content_groups, 0)
|
||||||
|
|
||||||
|
object
|
||||||
|
|> Map.put("content", content)
|
||||||
|
end
|
||||||
|
|
||||||
|
def fix_content_map(object), do: object
|
||||||
|
|
||||||
# TODO: validate those with a Ecto scheme
|
# TODO: validate those with a Ecto scheme
|
||||||
# - tags
|
# - tags
|
||||||
# - emoji
|
# - emoji
|
||||||
|
|
Loading…
Reference in a new issue