Move maybe_add_content_map out of Transmogrifier, use code from tusooa's branch for MapOfString

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2023-08-19 19:03:25 +02:00
commit 62340b50b5
9 changed files with 194 additions and 71 deletions

View file

@ -682,7 +682,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|> add_mention_tags
|> add_emoji_tags
|> add_attributed_to
|> maybe_add_content_map
|> prepare_attachments
|> set_conversation
|> set_reply_to_uri
@ -956,11 +955,4 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
def maybe_fix_user_url(data), do: data
def maybe_fix_user_object(data), do: maybe_fix_user_url(data)
defp maybe_add_content_map(%{"language" => language, "content" => content} = object)
when not_empty_string(language) do
Map.put(object, "contentMap", Map.put(%{}, language, content))
end
defp maybe_add_content_map(object), do: object
end