2018-04-12 02:43:48 -04:00
|
|
|
defmodule Mix.Tasks.RmUser do
|
|
|
|
use Mix.Task
|
2018-05-04 17:25:31 -04:00
|
|
|
alias Pleroma.User
|
2018-04-12 02:43:48 -04:00
|
|
|
|
2018-11-02 04:32:48 -04:00
|
|
|
@moduledoc """
|
|
|
|
Permanently deletes a user
|
|
|
|
|
|
|
|
Usage: ``mix rm_user [nickname]``
|
|
|
|
|
|
|
|
Example: ``mix rm_user lain``
|
|
|
|
"""
|
2018-04-12 02:43:48 -04:00
|
|
|
def run([nickname]) do
|
2018-04-18 10:52:25 -04:00
|
|
|
Mix.Task.run("app.start")
|
2018-04-12 02:43:48 -04:00
|
|
|
|
|
|
|
with %User{local: true} = user <- User.get_by_nickname(nickname) do
|
2018-11-01 03:56:21 -04:00
|
|
|
{:ok, _} = User.delete(user)
|
2018-04-12 02:43:48 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|