about summary refs log tree commit diff
path: root/app/models/account.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-07-02 16:57:28 +0200
committerGitHub <noreply@github.com>2021-07-02 16:57:28 +0200
commit0c2eb949fc21ceecbd99a81e5ffe75517a1e64df (patch)
tree9ac6855c447939733d97b9650acb06e8c2b0ca8b /app/models/account.rb
parentf4b9d94ce78761eb93c34333cbce5730da9ea97f (diff)
parent1e2097afd4d53c0b36bac9efba7d594725c5b8d9 (diff)
Merge pull request #1560 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 53c6a43a6..96f23979f 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -572,7 +572,11 @@ class Account < ApplicationRecord
   def create_canonical_email_block!
     return unless local? && user_email.present?
 
-    CanonicalEmailBlock.create(reference_account: self, email: user_email)
+    begin
+      CanonicalEmailBlock.create(reference_account: self, email: user_email)
+    rescue ActiveRecord::RecordNotUnique
+      # A canonical e-mail block may already exist for the same e-mail
+    end
   end
 
   def destroy_canonical_email_block!