transmogrifier: Use oneliners when applicable

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-09-26 21:01:33 +02:00
parent ed8dfa3029
commit 4c3a80de96
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -167,9 +167,7 @@ def fix_attachments(%{"attachment" => attachment} = object) when is_map(attachme
Map.put(object, "attachment", attachment)
end
def fix_attachments(object) do
object
end
def fix_attachments(object), do: object
def fix_emoji(%{"tag" => tags} = object) when is_list(tags) do
emoji = tags |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
@ -197,9 +195,7 @@ def fix_emoji(%{"tag" => %{"type" => "Emoji"} = tag} = object) do
|> Map.put("emoji", emoji)
end
def fix_emoji(object) do
object
end
def fix_emoji(object), do: object
def fix_tag(%{"tag" => tag} = object) when is_list(tag) do
tags =
@ -220,9 +216,7 @@ def fix_tag(%{"tag" => %{"type" => "Hashtag", "name" => hashtag} = tag} = object
|> Map.put("tag", combined)
end
def fix_tag(object) do
object
end
def fix_tag(object), do: object
# content map usually only has one language so this will do for now.
def fix_content_map(%{"contentMap" => content_map} = object) do