Verified Commit 0aac72f1 authored by Haelwenn's avatar Haelwenn
Browse files

[Pleroma.Web.ActivityPub.Transmogrifier]: quick fix when tag is a Map

parent 28e8a8ab
......@@ -194,18 +194,22 @@ def fix_emoji(object) do
object
end
def fix_tag(object) do
def fix_tag(%{"tag" => tag} = object) when is_list(tag) do
tags =
(object["tag"] || [])
tag
|> Enum.filter(fn data -> data["type"] == "Hashtag" and data["name"] end)
|> Enum.map(fn data -> String.slice(data["name"], 1..-1) end)
combined = (object["tag"] || []) ++ tags
combined = tag ++ tags
object
|> Map.put("tag", combined)
end
def fix_tag(object) do
object
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)
......
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