diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 1e8177ff5..6e4023b44 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1587,7 +1587,7 @@ defp object_to_user_data(data, additional) do actor_type = data["type"] || "Person" featured_address = data["featured"] - {:ok, pinned_objects} = fetch_and_prepare_outbox_from_ap_id(featured_address) + {:ok, pinned_objects} = fetch_and_prepare_collection_from_ap_id(featured_address) outbox_address = data["outbox"] # first, check that the owner is correct @@ -1792,7 +1792,7 @@ def maybe_handle_clashing_nickname(data) do end end - def activity_data_from_outbox_collection(%{ + def activity_data_from_collection(%{ "type" => "OrderedCollection", "first" => first }) do @@ -1807,7 +1807,7 @@ def activity_data_from_outbox_collection(%{ end end - def activity_data_from_outbox_collection( + def activity_data_from_collection( %{ "type" => type } = collection @@ -1823,23 +1823,23 @@ def activity_data_from_outbox_collection( end) end - def activity_data_from_outbox_collection(obj) do - Logger.error("Could not parse outbox collection #{inspect(obj)}") + def activity_data_from_collection(obj) do + Logger.error("Could not parse collection #{inspect(obj)}") %{} end - def fetch_and_prepare_outbox_from_ap_id(nil) do + def fetch_and_prepare_collection_from_ap_id(nil) do {:ok, %{}} end - def fetch_and_prepare_outbox_from_ap_id(ap_id) do - Logger.info("Fetching outbox #{ap_id}") + def fetch_and_prepare_collection_from_ap_id(ap_id) do + Logger.info("Fetching collection #{ap_id}") with {:ok, data} <- Fetcher.fetch_and_contain_remote_object_from_id(ap_id) do - {:ok, activity_data_from_outbox_collection(data)} + {:ok, activity_data_from_collection(data)} else e -> - Logger.error("Could not decode outbox collection at fetch #{ap_id}, #{inspect(e)}") + Logger.error("Could not decode collection at fetch #{ap_id}, #{inspect(e)}") {:ok, %{}} end end diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 76cf960cd..a4f8ca06a 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -640,7 +640,7 @@ defp handle_incoming_normalised( defp handle_incoming_normalised(%{"object" => o, "_akkoma_fake" => true}, options), do: handle_incoming_normalised(o, options) - defp handle_incoming_normalised(o, _), do: :error + defp handle_incoming_normalised(_, _), do: :error @spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil def get_obj_helper(id, options \\ []) do diff --git a/lib/pleroma/workers/remote_fetcher_worker.ex b/lib/pleroma/workers/remote_fetcher_worker.ex index 05e101166..ad68c79c8 100644 --- a/lib/pleroma/workers/remote_fetcher_worker.ex +++ b/lib/pleroma/workers/remote_fetcher_worker.ex @@ -14,7 +14,7 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do @impl Oban.Worker def perform(%Job{args: %{"op" => "fetch_outbox", "id" => address}}) do - with {:ok, outbox} <- ActivityPub.fetch_and_prepare_outbox_from_ap_id(address) do + with {:ok, outbox} <- ActivityPub.fetch_and_prepare_collection_from_ap_id(address) do Enum.each(Enum.reverse(outbox), fn {ap_id, _} -> if is_nil(Object.get_cached_by_ap_id(ap_id)) do perform(%{