Merge branch 'backport/issue-1296' into 'maint/1.1'
[akkoma] / lib / pleroma / object / fetcher.ex
index 305ce835702b9a279318033c641572971cb31e85..c1795ae0fe1e9c041d318335026b2744fae045d2 100644 (file)
@@ -114,12 +114,10 @@ defmodule Pleroma.Object.Fetcher do
     end
   end
 
-  def fetch_and_contain_remote_object_from_id(id) do
+  def fetch_and_contain_remote_object_from_id(id) when is_binary(id) do
     Logger.info("Fetching object #{id} via AP")
 
-    date =
-      NaiveDateTime.utc_now()
-      |> Timex.format!("{WDshort}, {0D} {Mshort} {YYYY} {h24}:{m}:{s} GMT")
+    date = Pleroma.Signature.signed_date()
 
     headers =
       [{:Accept, "application/activity+json"}]
@@ -141,4 +139,9 @@ defmodule Pleroma.Object.Fetcher do
         {:error, e}
     end
   end
+
+  def fetch_and_contain_remote_object_from_id(%{"id" => id}),
+    do: fetch_and_contain_remote_object_from_id(id)
+
+  def fetch_and_contain_remote_object_from_id(_id), do: {:error, "id must be a string"}
 end