From 4478b9115c088c637721ed2c3255222ec4cf54e2 Mon Sep 17 00:00:00 2001 From: Phenethylamine Date: Thu, 12 Apr 2018 02:43:48 -0400 Subject: [PATCH] Add rm_user mix task --- lib/mix/tasks/rm_user.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/mix/tasks/rm_user.ex diff --git a/lib/mix/tasks/rm_user.ex b/lib/mix/tasks/rm_user.ex new file mode 100644 index 000000000..30196d502 --- /dev/null +++ b/lib/mix/tasks/rm_user.ex @@ -0,0 +1,14 @@ +defmodule Mix.Tasks.RmUser do + use Mix.Task + import Mix.Ecto + alias Pleroma.{Repo, User} + + @shortdoc "Permanently delete a user" + def run([nickname]) do + ensure_started(Repo, []) + + with %User{local: true} = user <- User.get_by_nickname(nickname) do + Repo.delete!(user) + end + end +end -- 2.45.2