mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 04:07:33 +02:00
Allow punycode domains in bulk ns change domain scope
This commit is contained in:
parent
0e120d4992
commit
8bb0fd80d1
3 changed files with 10 additions and 7 deletions
|
@ -148,10 +148,12 @@ class Registrar < ApplicationRecord
|
|||
failed_list = []
|
||||
|
||||
nameservers.where(hostname: hostname).find_each do |origin|
|
||||
next unless domains.include?(origin.domain.name) || domains.empty?
|
||||
idn = origin.domain.name
|
||||
puny = origin.domain.name_puny
|
||||
next unless domains.include?(idn) || domains.include?(puny) || domains.empty?
|
||||
|
||||
if origin.domain.nameservers.where(hostname: new_attributes[:hostname]).any?
|
||||
failed_list << origin.domain.name
|
||||
failed_list << idn
|
||||
next
|
||||
end
|
||||
|
||||
|
@ -160,7 +162,7 @@ class Registrar < ApplicationRecord
|
|||
new_nameserver.attributes = new_attributes
|
||||
new_nameserver.save!
|
||||
|
||||
domain_list << origin.domain.name
|
||||
domain_list << idn
|
||||
|
||||
origin.destroy!
|
||||
end
|
||||
|
|
|
@ -67,7 +67,8 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] },
|
||||
affected_domains: ["airport.test", "shop.test"] }}),
|
||||
affected_domains: ["airport.test", "shop.test"],
|
||||
skipped_domains: [] }}),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class ReplaceNameserversTest < ActiveSupport::TestCase
|
|||
ipv6: '2001:db8::2' }
|
||||
result = @registrar.replace_nameservers('ns1.bestnames.test', new_attributes)
|
||||
|
||||
assert_equal(["airport.test", "shop.test"], result)
|
||||
assert_equal([["airport.test", "shop.test"], []], result)
|
||||
end
|
||||
|
||||
def test_replace_nameservers_in_bulk_returns_empty_array_for_non_existent_base_nameserver
|
||||
|
@ -18,7 +18,7 @@ class ReplaceNameserversTest < ActiveSupport::TestCase
|
|||
ipv6: '2001:db8::2' }
|
||||
result = @registrar.replace_nameservers('ns3.bestnames.test', new_attributes)
|
||||
|
||||
assert_equal([], result)
|
||||
assert_equal([[], []], result)
|
||||
end
|
||||
|
||||
def test_replace_nameserver_in_bulk_respects_domain_limit_scope
|
||||
|
@ -29,7 +29,7 @@ class ReplaceNameserversTest < ActiveSupport::TestCase
|
|||
ipv6: '2001:db8::2' }
|
||||
|
||||
result = @registrar.replace_nameservers('ns1.bestnames.test', new_attributes, domains: ['shop.test'])
|
||||
assert_equal(["shop.test"], result)
|
||||
assert_equal([["shop.test"], []], result)
|
||||
|
||||
unscoped_domain.reload
|
||||
eligible_domain.reload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue