about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/email_domain_blocks_controller.rb2
-rw-r--r--app/workers/scheduler/email_domain_block_refresh_scheduler.rb3
2 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/admin/email_domain_blocks_controller.rb b/app/controllers/admin/email_domain_blocks_controller.rb
index 33ee079f3..a4bbbba5b 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
diff --git a/app/workers/scheduler/email_domain_block_refresh_scheduler.rb b/app/workers/scheduler/email_domain_block_refresh_scheduler.rb
index c67be6843..e0ad89866 100644
--- a/app/workers/scheduler/email_domain_block_refresh_scheduler.rb
+++ b/app/workers/scheduler/email_domain_block_refresh_scheduler.rb
@@ -15,7 +15,8 @@ class Scheduler::EmailDomainBlockRefreshScheduler
           if ip?(email_domain_block.domain)
             [email_domain_block.domain]
           else
-            dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::A).to_a + dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::AAAA).to_a.map { |resource| resource.address.to_s }
+            resources = dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::A).to_a + dns.getresources(email_domain_block.domain, Resolv::DNS::Resource::IN::AAAA).to_a
+            resources.map { |resource| resource.address.to_s }
           end
         end