mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
[Pleroma.Web.ActivityPub.Transmogrifier]: quick fix when tag is a Map
This commit is contained in:
parent
28e8a8ab36
commit
0aac72f1d3
1 changed files with 7 additions and 3 deletions
|
@ -194,18 +194,22 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_tag(object) do
|
def fix_tag(%{"tag" => tag} = object) when is_list(tag) do
|
||||||
tags =
|
tags =
|
||||||
(object["tag"] || [])
|
tag
|
||||||
|> Enum.filter(fn data -> data["type"] == "Hashtag" and data["name"] end)
|
|> Enum.filter(fn data -> data["type"] == "Hashtag" and data["name"] end)
|
||||||
|> Enum.map(fn data -> String.slice(data["name"], 1..-1) end)
|
|> Enum.map(fn data -> String.slice(data["name"], 1..-1) end)
|
||||||
|
|
||||||
combined = (object["tag"] || []) ++ tags
|
combined = tag ++ tags
|
||||||
|
|
||||||
object
|
object
|
||||||
|> Map.put("tag", combined)
|
|> Map.put("tag", combined)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fix_tag(object) do
|
||||||
|
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
|
||||||
content_groups = Map.to_list(content_map)
|
content_groups = Map.to_list(content_map)
|
||||||
|
|
Loading…
Reference in a new issue