mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Refactor
This commit is contained in:
parent
c4d79047aa
commit
172a1bf664
1 changed files with 2 additions and 10 deletions
|
@ -239,11 +239,11 @@ class Domain < ActiveRecord::Base
|
||||||
# rubocop:enable Lint/Loop
|
# rubocop:enable Lint/Loop
|
||||||
|
|
||||||
def attach_default_contacts
|
def attach_default_contacts
|
||||||
if tech_contacts_count.zero?
|
if tech_domain_contacts.count.zero?
|
||||||
attach_contact(DomainContact::TECH, owner_contact)
|
attach_contact(DomainContact::TECH, owner_contact)
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless admin_contacts_count.zero? && owner_contact.citizen?
|
return unless admin_domain_contacts.count.zero? && owner_contact.citizen?
|
||||||
attach_contact(DomainContact::ADMIN, owner_contact)
|
attach_contact(DomainContact::ADMIN, owner_contact)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -263,14 +263,6 @@ class Domain < ActiveRecord::Base
|
||||||
self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
|
self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tech_contacts_count
|
|
||||||
domain_contacts.reject(&:marked_for_destruction?).select { |x| x.contact_type == DomainContact::TECH }.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def admin_contacts_count
|
|
||||||
domain_contacts.reject(&:marked_for_destruction?).select { |x| x.contact_type == DomainContact::ADMIN }.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def manage_automatic_statuses
|
def manage_automatic_statuses
|
||||||
if domain_statuses.empty? && valid?
|
if domain_statuses.empty? && valid?
|
||||||
domain_statuses.create(value: DomainStatus::OK)
|
domain_statuses.create(value: DomainStatus::OK)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue