Fix domain statuses logic

This commit is contained in:
dinsmol 2021-12-15 17:31:53 +03:00
parent 07e791da36
commit fa5203d0a1

View file

@ -121,8 +121,8 @@ class Domain < ApplicationRecord
validate :status_is_consistant validate :status_is_consistant
def status_is_consistant def status_is_consistant
has_error = (hold_status? && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)) has_error = (hold_status? && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
if !has_error && (statuses & DELETE_STATUSES).any? if !has_error && statuses.include?(DomainStatus::PENDING_DELETE)
has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED unless locked_by_registrant? has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED
end end
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
end end