add mix task for deactivating a user by nickname
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 13 May 2018 23:33:43 +0000 (23:33 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Mon, 14 May 2018 00:05:03 +0000 (19:05 -0500)
lib/mix/tasks/deactivate_user.ex [new file with mode: 0644]

diff --git a/lib/mix/tasks/deactivate_user.ex b/lib/mix/tasks/deactivate_user.ex
new file mode 100644 (file)
index 0000000..96b3db6
--- /dev/null
@@ -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