Feature/896 toggling confirmation
This commit is contained in:
parent
a2771869a3
commit
73ae58fdfa
6 changed files with 80 additions and 2 deletions
|
|
@ -77,6 +77,10 @@ defmodule Mix.Tasks.Pleroma.User do
|
|||
## Delete tags from a user.
|
||||
|
||||
mix pleroma.user untag NICKNAME TAGS
|
||||
|
||||
## Toggle confirmation of the user's account.
|
||||
|
||||
mix pleroma.user toggle_confirmed NICKNAME
|
||||
"""
|
||||
def run(["new", nickname, email | rest]) do
|
||||
{options, [], []} =
|
||||
|
|
@ -388,6 +392,21 @@ defmodule Mix.Tasks.Pleroma.User do
|
|||
end
|
||||
end
|
||||
|
||||
def run(["toggle_confirmed", nickname]) do
|
||||
Common.start_pleroma()
|
||||
|
||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||
{:ok, user} = User.toggle_confirmation(user)
|
||||
|
||||
message = if user.info.confirmation_pending, do: "needs", else: "doesn't need"
|
||||
|
||||
Mix.shell().info("#{nickname} #{message} confirmation.")
|
||||
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})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue