diff --git a/lib/gabsocial/accounts_cli.rb b/lib/gabsocial/accounts_cli.rb index 58aad89a..eb879464 100644 --- a/lib/gabsocial/accounts_cli.rb +++ b/lib/gabsocial/accounts_cli.rb @@ -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'