Tech replace: Skip if domain has update prohibited

This commit is contained in:
Karl Erik Õunapuu 2021-02-11 15:08:26 +02:00
parent 44226aa5d6
commit 5693d0dd74
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 7 additions and 2 deletions

View file

@ -492,7 +492,7 @@ class Domain < ApplicationRecord
# depricated not used, not valid # depricated not used, not valid
def update_prohibited? def update_prohibited?
pending_update_prohibited? && pending_delete_prohibited? (statuses & DomainStatus::UPDATE_PROHIBIT_STATES).present?
end end
# public api # public api

View file

@ -6,7 +6,7 @@ class TechDomainContact < DomainContact
tech_contacts = where(contact: current_contact) tech_contacts = where(contact: current_contact)
tech_contacts.each do |tech_contact| tech_contacts.each do |tech_contact|
if tech_contact.domain.bulk_update_prohibited? if irreplaceable?(tech_contact)
skipped_domains << tech_contact.domain.name skipped_domains << tech_contact.domain.name
next next
end end
@ -20,4 +20,9 @@ class TechDomainContact < DomainContact
end end
[affected_domains.sort, skipped_domains.sort] [affected_domains.sort, skipped_domains.sort]
end end
def self.irreplaceable?(tech_contact)
dn = tech_contact.domain
dn.bulk_update_prohibited? || dn.update_prohibited? || dn.tech_change_prohibited?
end
end end