Do not refetch local objects
authorrinpatch <rinpatch@sdf.org>
Wed, 18 Sep 2019 16:59:23 +0000 (19:59 +0300)
committerAriadne Conill <ariadne@dereferenced.org>
Sun, 6 Oct 2019 14:53:48 +0000 (14:53 +0000)
lib/pleroma/object/fetcher.ex

index fecc97c5e5635861aa8ca592c96024d4697bce41..91e6b6dcac888d76b156e34da257ae90ef9caf15 100644 (file)
@@ -48,10 +48,12 @@ defmodule Pleroma.Object.Fetcher do
   end
 
   def refetch_object(%Object{data: %{"id" => id}} = object) do
-    with {:ok, data} <- fetch_and_contain_remote_object_from_id(id),
+    with {:local, false} <- {:local, String.starts_with?(id, Pleroma.Web.base_url() <> "/")},
+         {:ok, data} <- fetch_and_contain_remote_object_from_id(id),
          {:ok, object} <- reinject_object(object, data) do
       {:ok, object}
     else
+      {:local, true} -> object
       e -> {:error, e}
     end
   end