From 6aef76b5cde2315135d53215d13a9b2ec0a1adaa Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 26 Feb 2022 17:26:28 +0100 Subject: [PATCH] Fix error when a MX is shared across blocked domains (#17650) --- app/controllers/admin/email_domain_blocks_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/admin/email_domain_blocks_controller.rb b/app/controllers/admin/email_domain_blocks_controller.rb index 33ee079f36..a4bbbba5ba 100644 --- a/app/controllers/admin/email_domain_blocks_controller.rb +++ b/app/controllers/admin/email_domain_blocks_controller.rb @@ -38,6 +38,8 @@ module Admin log_action :create, @email_domain_block (@email_domain_block.other_domains || []).uniq.each do |domain| + next if EmailDomainBlock.where(domain: domain).exists? + other_email_domain_block = EmailDomainBlock.create!(domain: domain, parent: @email_domain_block) log_action :create, other_email_domain_block end