Delete attachments after object and cache cleanup
authorRoman Chvanikov <chvanikoff@pm.me>
Fri, 17 Jan 2020 17:20:37 +0000 (20:20 +0300)
committerRoman Chvanikov <chvanikoff@pm.me>
Fri, 17 Jan 2020 17:20:37 +0000 (20:20 +0300)
lib/pleroma/object.ex

index 6c56a9c62f005b41a0a9436eda79fb721058b9b9..499339982b9c1b314a2d4eeded4ed01a8ff64e59 100644 (file)
@@ -180,10 +180,10 @@ defmodule Pleroma.Object do
 
   def delete(%Object{data: %{"id" => id}} = object) do
     with {:ok, _obj} = swap_object_with_tombstone(object),
-         :ok <- delete_attachments(object),
          deleted_activity = Activity.delete_all_by_object_ap_id(id),
          {:ok, true} <- Cachex.del(:object_cache, "object:#{id}"),
-         {:ok, _} <- Cachex.del(:web_resp_cache, URI.parse(id).path) do
+         {:ok, _} <- Cachex.del(:web_resp_cache, URI.parse(id).path),
+         :ok <- delete_attachments(object) do
       {:ok, object, deleted_activity}
     end
   end