forked from AkkomaGang/akkoma
Pleroma.Web.ActivityPub.Transmogrifier: Fix actor being a list of objects (Peertube)
This commit is contained in:
parent
c1b8a6a73b
commit
ef4f982e2c
1 changed files with 6 additions and 6 deletions
|
@ -18,18 +18,18 @@ def get_actor(%{"actor" => actor}) when is_binary(actor) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_actor(%{"actor" => actor}) when is_list(actor) do
|
def get_actor(%{"actor" => actor}) when is_list(actor) do
|
||||||
Enum.at(actor, 0)
|
if is_binary(Enum.at(actor, 0)) do
|
||||||
|
Enum.at(actor, 0)
|
||||||
|
else
|
||||||
|
Enum.find(actor, fn %{"type" => type} -> type == "Person" end)
|
||||||
|
|> Map.get("id")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_actor(%{"actor" => actor}) when is_map(actor) do
|
def get_actor(%{"actor" => actor}) when is_map(actor) do
|
||||||
actor["id"]
|
actor["id"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_actor(%{"actor" => actor_list}) do
|
|
||||||
Enum.find(actor_list, fn %{"type" => type} -> type == "Person" end)
|
|
||||||
|> Map.get("id")
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Modifies an incoming AP object (mastodon format) to our internal format.
|
Modifies an incoming AP object (mastodon format) to our internal format.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue