about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-07-14 05:35:49 +0200
committerGitHub <noreply@github.com>2021-07-14 05:35:49 +0200
commit30ce6e395c5094c3989288619a99f539bb61f05d (patch)
tree22538e3652e13a185d7d4311f38245889264db2a /app/models
parent31593d14269bd5f21151d70eec1031aa30ee0937 (diff)
Fix user email address being banned on self-deletion (#16503)
* Add tests

* Fix user email address being banned on self-deletion

Fixes #16498
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 8be36bf5b..a6d8d1537 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -232,11 +232,11 @@ class Account < ApplicationRecord
     suspended? && deletion_request.present?
   end
 
-  def suspend!(date: Time.now.utc, origin: :local)
+  def suspend!(date: Time.now.utc, origin: :local, block_email: true)
     transaction do
       create_deletion_request!
       update!(suspended_at: date, suspension_origin: origin)
-      create_canonical_email_block!
+      create_canonical_email_block! if block_email
     end
   end