From a6a6915aaf568dda8b784438b963e341c2fc0f29 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 13 May 2018 23:33:43 +0000 Subject: [PATCH] add mix task for deactivating a user by nickname --- lib/mix/tasks/deactivate_user.ex | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/mix/tasks/deactivate_user.ex diff --git a/lib/mix/tasks/deactivate_user.ex b/lib/mix/tasks/deactivate_user.ex new file mode 100644 index 000000000..96b3db6e4 --- /dev/null +++ b/lib/mix/tasks/deactivate_user.ex @@ -0,0 +1,13 @@ +defmodule Mix.Tasks.DeactivateUser do + use Mix.Task + alias Pleroma.User + + @shortdoc "Toggle deactivation status for a user" + def run([nickname]) do + Mix.Task.run("app.start") + + with user <- User.get_by_nickname(nickname) do + User.deactivate(user) + end + end +end