about summary refs log tree commit diff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-12-17 23:02:14 +0100
committerGitHub <noreply@github.com>2021-12-17 23:02:14 +0100
commit76761d5fc0886e44a7a6eb94ab62aae8204d9e6e (patch)
tree95cd6ad55eb9c249e212af2378c23160785ec34c /app/controllers/admin
parent7f803c41e2ca54b7b787b1f111f91357136c0e68 (diff)
Add ability for admins to delete canonical email blocks (#16644)
* Add admin option to remove canonical email blocks from a deleted account

* Add tootctl canonical_email_blocks to inspect and remove canonical email blocks
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/accounts_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb
index 948e70d5b..0786985fa 100644
--- a/app/controllers/admin/accounts_controller.rb
+++ b/app/controllers/admin/accounts_controller.rb
@@ -117,6 +117,16 @@ module Admin
       redirect_to admin_account_path(@account.id), notice: I18n.t('admin.accounts.removed_header_msg', username: @account.acct)
     end
 
+    def unblock_email
+      authorize @account, :unblock_email?
+
+      CanonicalEmailBlock.where(reference_account: @account).delete_all
+
+      log_action :unblock_email, @account
+
+      redirect_to admin_account_path(@account.id), notice: I18n.t('admin.accounts.unblocked_email_msg', username: @account.acct)
+    end
+
     private
 
     def set_account