From ef4f982e2c6447733679f3e490c2666c7a795a5f Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 1 Aug 2018 03:24:39 +0200 Subject: [PATCH] Pleroma.Web.ActivityPub.Transmogrifier: Fix actor being a list of objects (Peertube) --- lib/pleroma/web/activity_pub/transmogrifier.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index e5fb6e033..39e2bb8a9 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -18,18 +18,18 @@ def get_actor(%{"actor" => actor}) when is_binary(actor) do end 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 def get_actor(%{"actor" => actor}) when is_map(actor) do actor["id"] end - def get_actor(%{"actor" => actor_list}) do - Enum.find(actor_list, fn %{"type" => type} -> type == "Person" end) - |> Map.get("id") - end - @doc """ Modifies an incoming AP object (mastodon format) to our internal format. """