activitypub: user fetching: use fetch_and_contain_remote_object_from_id()

This commit is contained in:
William Pitcock 2018-11-17 20:13:38 +00:00
parent 1a940cb46e
commit c88533209c

View File

@ -628,9 +628,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end end
def fetch_and_prepare_user_from_ap_id(ap_id) do def fetch_and_prepare_user_from_ap_id(ap_id) do
with {:ok, %{status_code: 200, body: body}} <- with {:ok, data} <- fetch_and_contain_remote_object_from_id(ap_id) do
@httpoison.get(ap_id, [Accept: "application/activity+json"], follow_redirect: true),
{:ok, data} <- Jason.decode(body) do
user_data_from_user_object(data) user_data_from_user_object(data)
else else
e -> Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}") e -> Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}")