Commit e97b254c authored by lain's avatar lain
Browse files

Transmogrifier: Refactor and unify incoming tag handling

parent 39fd4d76
Pipeline #32088 passed with stages
in 34 minutes and 12 seconds
......@@ -323,14 +323,12 @@ def fix_tag(%{"tag" => tag} = object) when is_list(tag) do
Map.put(object, "tag", tag ++ tags)
end
def fix_tag(%{"tag" => %{"type" => "Hashtag", "name" => hashtag} = tag} = object) do
combined = [tag, String.slice(hashtag, 1..-1)]
Map.put(object, "tag", combined)
def fix_tag(%{"tag" => %{} = tag} = object) do
object
|> Map.put("tag", [tag])
|> fix_tag
end
def fix_tag(%{"tag" => %{} = tag} = object), do: Map.put(object, "tag", [tag])
def fix_tag(object), do: object
# content map usually only has one language so this will do for now.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment