feat: make technical contacts optional for all domains

- Remove automatic tech contact assignment from admin contacts
- Set minimum tech contacts to 0 for all registrant types
- Update tests to reflect optional tech contacts
- Keep max tech contacts limit from settings

This change implements the requirement to make technical contacts optional
for all domain types while maintaining the maximum limit from settings.
Previously tech contacts were required for organizations and automatically
copied from admin contacts.
This commit is contained in:
oleghasjanov 2025-01-31 15:49:35 +02:00
parent c2affb393f
commit cd5de3bd14
5 changed files with 42 additions and 9 deletions

View file

@ -235,9 +235,7 @@ class DomainTest < ActiveSupport::TestCase
def test_validates_tech_contact_count
domain_contact_attributes = domain_contacts(:shop_william).dup.attributes
domain = valid_domain
min_count = 1
max_count = 2
Setting.tech_contacts_min_count = min_count
Setting.tech_contacts_max_count = max_count
domain.registrant.update!(ident_type: 'org')
@ -245,16 +243,12 @@ class DomainTest < ActiveSupport::TestCase
assert domain.registrant.org?
domain.tech_domain_contacts.clear
min_count.times { domain.tech_domain_contacts.build(domain_contact_attributes) }
assert domain.valid?, proc { domain.errors.full_messages }
domain.tech_domain_contacts.clear
max_count.times { domain.tech_domain_contacts.build(domain_contact_attributes) }
assert domain.valid?, proc { domain.errors.full_messages }
domain.tech_domain_contacts.clear
assert domain.invalid?
domain.tech_domain_contacts.clear
max_count.next.times { domain.tech_domain_contacts.build(domain_contact_attributes) }
assert domain.invalid?