about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-10-02 12:01:40 +0200
committerGitHub <noreply@github.com>2018-10-02 12:01:40 +0200
commit35e9d099b3febd75d1613dfc8a494e769a98c3a6 (patch)
tree2aceaee757bd292e3d05811673a7bfe419e7b064 /lib
parent4e60a0d5433f5dfa4f71a452cc5c6ceb0f21ceab (diff)
parent6ad76069096005d7b55d9c63a567f843997a8068 (diff)
Merge pull request #758 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/accounts_cli.rb26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb
index 65c1b395a..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]
@@ -170,11 +171,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