diff options
author | rinpatch <rinpatch@sdf.org> | 2019-04-17 14:21:39 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-04-17 14:21:39 +0300 |
commit | e7c3c367667e96ef7fe31ef9dd8337b563a3ccaa (patch) | |
tree | 345dd0ad95eda15cea4968a3f27b729af15ed3ca /lib | |
parent | b09ae02c04d66e58c2bcc6ce10277c88d5fed576 (diff) | |
download | pleroma-e7c3c367667e96ef7fe31ef9dd8337b563a3ccaa.tar.gz |
Update functions in object fetcher for tesla and set up a proper mock for tests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/object/fetcher.ex | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/pleroma/object/fetcher.ex b/lib/pleroma/object/fetcher.ex index 19d9c51af..138e7866f 100644 --- a/lib/pleroma/object/fetcher.ex +++ b/lib/pleroma/object/fetcher.ex @@ -27,7 +27,7 @@ defmodule Pleroma.Object.Fetcher do }, :ok <- Containment.contain_origin(id, params), {:ok, activity} <- Transmogrifier.handle_incoming(params) do - {:ok, Object.normalize(activity.data["object"], false)} + {:ok, Object.normalize(activity, false)} else {:error, {:reject, nil}} -> {:reject, nil} @@ -56,16 +56,13 @@ defmodule Pleroma.Object.Fetcher do end def fetch_and_contain_remote_object_from_id(id) do - Logger.info("Fetching #{id} via AP") + Logger.info("Fetching object #{id} via AP") with true <- String.starts_with?(id, "http"), - {:ok, %{body: body, status_code: code}} when code in 200..299 <- + {:ok, %{body: body, status: code}} when code in 200..299 <- @httpoison.get( id, - [Accept: "application/activity+json"], - follow_redirect: true, - timeout: 10000, - recv_timeout: 20000 + [{:Accept, "application/activity+json"}] ), {:ok, data} <- Jason.decode(body), :ok <- Containment.contain_origin_from_id(id, data) do |