[#570] add user:notification stream
[akkoma] / lib / pleroma / object / fetcher.ex
index bb9388d4f905e802605da7d58e5bec28b8d008ad..c422490ac4ae922399589d7ee842e5eb21a4a434 100644 (file)
@@ -1,4 +1,5 @@
 defmodule Pleroma.Object.Fetcher do
+  alias Pleroma.HTTP
   alias Pleroma.Object
   alias Pleroma.Object.Containment
   alias Pleroma.Web.ActivityPub.Transmogrifier
@@ -6,8 +7,6 @@ defmodule Pleroma.Object.Fetcher do
 
   require Logger
 
-  @httpoison Application.get_env(:pleroma, :httpoison)
-
   defp reinject_object(data) do
     Logger.debug("Reinjecting object #{data["id"]}")
 
@@ -78,7 +77,7 @@ defmodule Pleroma.Object.Fetcher do
 
     with true <- String.starts_with?(id, "http"),
          {:ok, %{body: body, status: code}} when code in 200..299 <-
-           @httpoison.get(
+           HTTP.get(
              id,
              [{:Accept, "application/activity+json"}]
            ),
@@ -86,6 +85,9 @@ defmodule Pleroma.Object.Fetcher do
          :ok <- Containment.contain_origin_from_id(id, data) do
       {:ok, data}
     else
+      {:ok, %{status: code}} when code in [404, 410] ->
+        {:error, "Object has been deleted"}
+
       e ->
         {:error, e}
     end