Bulk NS change: track untouched domains

This commit is contained in:
Karl Erik Õunapuu 2020-12-30 12:46:51 +02:00
parent 8bb0fd80d1
commit af0a0611ce
No known key found for this signature in database
GPG key ID: C9DD647298A34764
4 changed files with 20 additions and 15 deletions

View file

@ -144,6 +144,7 @@ class Registrar < ApplicationRecord
# Audit log is needed, therefore no raw SQL
def replace_nameservers(hostname, new_attributes, domains: [])
transaction do
domain_scope = domains.dup
domain_list = []
failed_list = []
@ -162,13 +163,14 @@ class Registrar < ApplicationRecord
new_nameserver.attributes = new_attributes
new_nameserver.save!
domain_scope.delete_if { |i| i == idn || i == puny }
domain_list << idn
origin.destroy!
end
self.domains.where(name: domain_list).find_each(&:update_whois_record) if domain_list.any?
[domain_list.uniq.sort, failed_list.uniq.sort]
[domain_list.uniq.sort, (domain_scope + failed_list).uniq.sort]
end
end