gabctl accounts delete|suspend separated

`gabctl accounts suspend` does not remove user (can be undone).
`gabctl accounts delete` does remove user (cannot be undone).
This commit is contained in:
Rob Colbert 2019-07-23 19:38:15 -04:00
parent 040f7c5106
commit 90ad01d133
1 changed files with 19 additions and 2 deletions

View File

@ -170,7 +170,7 @@ module GabSocial
desc 'delete USERNAME', 'Delete a user'
long_desc <<-LONG_DESC
Remove a user account with a given USERNAME.
Suspend the account matching USERNAME and remove the associated user (can't be undone).
LONG_DESC
def delete(username)
account = Account.find_local(username)
@ -180,7 +180,7 @@ module GabSocial
exit(1)
end
say("Deleting user with #{account.statuses_count} statuses, this might take a while...")
say("Suspending account, removing #{account.statuses_count} statuses and user...")
SuspendAccountService.new.call(account, including_user: true)
say('OK', :green)
end
@ -439,6 +439,23 @@ module GabSocial
end
end
desc 'suspend USERNAME', 'Suspend a user'
long_desc <<-LONG_DESC
Suspend the user account with the given USERNAME (can be undone).
LONG_DESC
def suspend(username)
account = Account.find_local(username)
if account.nil?
say('No user with such username', :red)
exit(1)
end
say("Suspending user and removing #{account.statuses_count} statuses...")
SuspendAccountService.new.call(account, including_user: false)
say('OK', :green)
end
option :number, type: :numeric, aliases: [:n]
option :all, type: :boolean
desc 'approve [USERNAME]', 'Approve pending accounts'