user: use preloads when deleting accounts
This commit is contained in:
parent
debf7f016d
commit
332dc1371b
|
@ -1110,13 +1110,15 @@ def delete(%User{} = user) do
|
||||||
friends
|
friends
|
||||||
|> Enum.each(fn followed -> User.unfollow(user, followed) end)
|
|> 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)
|
Repo.all(query)
|
||||||
|> Enum.each(fn activity ->
|
|> Enum.each(fn activity ->
|
||||||
case activity.data["type"] do
|
case activity.data["type"] do
|
||||||
"Create" ->
|
"Create" ->
|
||||||
ActivityPub.delete(Object.normalize(activity.data["object"]))
|
ActivityPub.delete(Object.normalize(activity))
|
||||||
|
|
||||||
# TODO: Do something with likes, follows, repeats.
|
# TODO: Do something with likes, follows, repeats.
|
||||||
_ ->
|
_ ->
|
||||||
|
|
Loading…
Reference in New Issue