1
0

Purge a local user upon deletion, fixes #2062

This commit is contained in:
Alex Gleason
2020-08-17 21:52:28 -05:00
parent 34b099fffa
commit d55faa2f8f
2 changed files with 36 additions and 3 deletions
+13 -1
View File
@@ -1583,6 +1583,18 @@ defmodule Pleroma.User do
|> update_and_set_cache()
end
@spec purge_user_changeset(User.t()) :: Changeset.t()
def purge_user_changeset(user) do
change(user, %{
deactivated: true,
email: nil,
avatar: %{},
banner: %{},
background: %{},
fields: []
})
end
def delete(users) when is_list(users) do
for user <- users, do: delete(user)
end
@@ -1610,7 +1622,7 @@ defmodule Pleroma.User do
_ ->
user
|> change(%{deactivated: true, email: nil})
|> purge_user_changeset()
|> update_and_set_cache()
end
end