user: use preloads when deleting accounts
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 23 Mar 2019 03:04:42 +0000 (03:04 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 23 Mar 2019 03:06:00 +0000 (03:06 +0000)
lib/pleroma/user.ex

index f2ef0a838e87b9f9c8998146fe312734e14a9a7e..41289b4d0591cb6cad4b07d768075726ba95d4b2 100644 (file)
@@ -1110,13 +1110,15 @@ defmodule Pleroma.User do
     friends
     |> Enum.each(fn followed -> User.unfollow(user, followed) end)
 
-    query = from(a in Activity, where: a.actor == ^user.ap_id)
+    query =
+      from(a in Activity, where: a.actor == ^user.ap_id)
+      |> Activity.with_preloaded_object()
 
     Repo.all(query)
     |> Enum.each(fn activity ->
       case activity.data["type"] do
         "Create" ->
-          ActivityPub.delete(Object.normalize(activity.data["object"]))
+          ActivityPub.delete(Object.normalize(activity))
 
         # TODO: Do something with likes, follows, repeats.
         _ ->