mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
Merge pull request #321 from internetee/registry-267
Fix domain "OK" status algo
This commit is contained in:
commit
06b45dce27
1 changed files with 6 additions and 6 deletions
|
@ -684,20 +684,20 @@ class Domain < ActiveRecord::Base
|
||||||
# rubocop: disable Metrics/CyclomaticComplexity
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
# rubocop: disable Metrics/PerceivedComplexity
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
def manage_automatic_statuses
|
def manage_automatic_statuses
|
||||||
|
if !self.class.nameserver_required?
|
||||||
|
deactivate if nameservers.reject(&:marked_for_destruction?).empty?
|
||||||
|
activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
|
||||||
|
end
|
||||||
|
|
||||||
if statuses.empty? && valid?
|
if statuses.empty? && valid?
|
||||||
statuses << DomainStatus::OK
|
statuses << DomainStatus::OK
|
||||||
elsif statuses.length > 1 || !valid?
|
elsif (statuses.length > 1 && active?) || !valid?
|
||||||
statuses.delete(DomainStatus::OK)
|
statuses.delete(DomainStatus::OK)
|
||||||
end
|
end
|
||||||
|
|
||||||
p_d = statuses.include?(DomainStatus::PENDING_DELETE)
|
p_d = statuses.include?(DomainStatus::PENDING_DELETE)
|
||||||
s_h = (statuses & [DomainStatus::SERVER_MANUAL_INZONE, DomainStatus::SERVER_HOLD]).empty?
|
s_h = (statuses & [DomainStatus::SERVER_MANUAL_INZONE, DomainStatus::SERVER_HOLD]).empty?
|
||||||
statuses << DomainStatus::SERVER_HOLD if p_d && s_h
|
statuses << DomainStatus::SERVER_HOLD if p_d && s_h
|
||||||
|
|
||||||
if !self.class.nameserver_required?
|
|
||||||
deactivate if nameservers.reject(&:marked_for_destruction?).empty?
|
|
||||||
activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue