activitypub: user fetching: use fetch_and_contain_remote_object_from_id()
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 17 Nov 2018 20:13:38 +0000 (20:13 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 17 Nov 2018 20:16:03 +0000 (20:16 +0000)
lib/pleroma/web/activity_pub/activity_pub.ex

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