Commit d013b58e authored by minibikini's avatar minibikini
Browse files

add `mix pleroma.user delete_activities NICKNAME` task

parent 10248d86
......@@ -304,6 +304,18 @@ def run(["invite"]) do
end
end
def run(["delete_activities", nickname]) do
Common.start_pleroma()
with %User{local: true} = user <- User.get_by_nickname(nickname) do
User.delete_user_activities(user)
Mix.shell().info("User #{nickname} deleted.")
else
_ ->
Mix.shell().error("No local user #{nickname}")
end
end
defp set_moderator(user, value) do
info_cng = User.Info.admin_api_update(user.info, %{is_moderator: value})
......
......@@ -1083,6 +1083,12 @@ def delete(%User{} = user) do
friends
|> Enum.each(fn followed -> User.unfollow(user, followed) end)
delete_user_activities(user)
{:ok, user}
end
def delete_user_activities(user) do
query = from(a in Activity, where: a.actor == ^user.ap_id)
Repo.all(query)
......@@ -1096,8 +1102,6 @@ def delete(%User{} = user) do
"Doing nothing"
end
end)
{:ok, user}
end
def html_filter_policy(%User{info: %{no_rich_text: true}}) do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment