This commit is contained in:
Martin Lensment 2015-01-02 16:39:35 +02:00
parent c4d79047aa
commit 172a1bf664

View file

@ -239,11 +239,11 @@ class Domain < ActiveRecord::Base
# rubocop:enable Lint/Loop
def attach_default_contacts
if tech_contacts_count.zero?
if tech_domain_contacts.count.zero?
attach_contact(DomainContact::TECH, owner_contact)
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)
end
@ -263,14 +263,6 @@ class Domain < ActiveRecord::Base
self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
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
if domain_statuses.empty? && valid?
domain_statuses.create(value: DomainStatus::OK)