From 332dc1371bd708c69517af5972f71cf86b477614 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 23 Mar 2019 03:04:42 +0000 Subject: [PATCH] user: use preloads when deleting accounts --- lib/pleroma/user.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index f2ef0a838..41289b4d0 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -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. _ -> -- 2.45.2