mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-14 11:34:15 +00:00
transmogrifier: Use oneliners when applicable
This commit is contained in:
parent
ed8dfa3029
commit
4c3a80de96
|
@ -167,9 +167,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
Map.put(object, "attachment", attachment)
|
Map.put(object, "attachment", attachment)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_attachments(object) do
|
def fix_attachments(object), do: object
|
||||||
object
|
|
||||||
end
|
|
||||||
|
|
||||||
def fix_emoji(%{"tag" => tags} = object) when is_list(tags) do
|
def fix_emoji(%{"tag" => tags} = object) when is_list(tags) do
|
||||||
emoji = tags |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
|
emoji = tags |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
|
||||||
|
@ -197,9 +195,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
|> Map.put("emoji", emoji)
|
|> Map.put("emoji", emoji)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_emoji(object) do
|
def fix_emoji(object), do: object
|
||||||
object
|
|
||||||
end
|
|
||||||
|
|
||||||
def fix_tag(%{"tag" => tag} = object) when is_list(tag) do
|
def fix_tag(%{"tag" => tag} = object) when is_list(tag) do
|
||||||
tags =
|
tags =
|
||||||
|
@ -220,9 +216,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
|> Map.put("tag", combined)
|
|> Map.put("tag", combined)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_tag(object) do
|
def fix_tag(object), do: object
|
||||||
object
|
|
||||||
end
|
|
||||||
|
|
||||||
# content map usually only has one language so this will do for now.
|
# content map usually only has one language so this will do for now.
|
||||||
def fix_content_map(%{"contentMap" => content_map} = object) do
|
def fix_content_map(%{"contentMap" => content_map} = object) do
|
||||||
|
|
Loading…
Reference in a new issue