Add DomainResource class to wrap MX lookup/normalize (#32864)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2024-11-14 13:47:29 +00:00
1 parent e8b6607ece
commit 62d65504f6
6 files changed
+46 -19

No files matched your search

+1 -6
View File
@@ -45,12 +45,7 @@ module Mastodon::CLI
end
other_domains = []
if options[:with_dns_records]
Resolv::DNS.open do |dns|
dns.timeouts = 5
other_domains = dns.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }.compact_blank
end
end
other_domains = DomainResource.new(domain).mx if options[:with_dns_records]
email_domain_block = EmailDomainBlock.new(domain: domain, other_domains: other_domains)
email_domain_block.save!