mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Story #104525314 - feature reject combination of delete with deleteProhibited
This commit is contained in:
parent
c40a282a63
commit
95bf081b53
1 changed files with 5 additions and 0 deletions
|
@ -116,6 +116,11 @@ class Domain < ActiveRecord::Base
|
|||
validate :status_is_consistant
|
||||
def status_is_consistant
|
||||
has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
|
||||
unless has_error
|
||||
if (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE, DomainStatus::FORCE_DELETE]).any?
|
||||
has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED
|
||||
end
|
||||
end
|
||||
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue