From 38f5f9cf5bc7d053b53ddf1661fa0b12878a87cd Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 28 Sep 2018 03:34:24 +0200 Subject: Add tootctl accounts backup (#8811) --- lib/mastodon/accounts_cli.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 65c1b395a..b743c5ea1 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -170,11 +170,32 @@ module Mastodon exit(1) end - say("Deleting user with #{account.statuses_count}, this might take a while...") + say("Deleting user with #{account.statuses_count} statuses, this might take a while...") SuspendAccountService.new.call(account, remove_user: true) say('OK', :green) end + desc 'backup USERNAME', 'Request a backup for a user' + long_desc <<-LONG_DESC + Request a new backup for an account with a given USERNAME. + + The backup will be created in Sidekiq asynchronously, and + the user will receive an e-mail with a link to it once + it's done. + LONG_DESC + def backup(username) + account = Account.find_local(username) + + if account.nil? + say('No user with such username', :red) + exit(1) + end + + backup = account.user.backups.create! + BackupWorker.perform_async(backup.id) + say('OK', :green) + end + option :dry_run, type: :boolean desc 'cull', 'Remove remote accounts that no longer exist' long_desc <<-LONG_DESC -- cgit From ac07bfb018b61dd1d9e6c47d4ebafe822d606e59 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 29 Sep 2018 11:40:40 +0200 Subject: Fix tootctl accounts reattaching not unsuspending deleted account (#8812) --- lib/mastodon/accounts_cli.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index b743c5ea1..704cf474b 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -83,7 +83,8 @@ module Mastodon end end - user.account = account + account.suspended = false + user.account = account if user.save if options[:confirmed] -- cgit