mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Add owner to technical and admin contact when no other contacts are specified
This commit is contained in:
parent
62b3ff6fc7
commit
3c3a8bfb47
3 changed files with 31 additions and 5 deletions
|
@ -36,12 +36,23 @@ class Domain < ActiveRecord::Base
|
|||
def attach_contacts(contacts)
|
||||
contacts.each do |k, v|
|
||||
v.each do |x|
|
||||
domain_contacts.create(
|
||||
contact: Contact.find_by(code: x[:contact]),
|
||||
contact_type: k
|
||||
)
|
||||
attach_contact(k, Contact.find_by(code: x[:contact]))
|
||||
end
|
||||
end
|
||||
|
||||
if owner_contact.citizen?
|
||||
attach_contact(Contact::CONTACT_TYPE_TECH, owner_contact) if tech_contacts.empty?
|
||||
attach_contact(Contact::CONTACT_TYPE_ADMIN, owner_contact) if admin_contacts.empty?
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def attach_contact(type, contact)
|
||||
domain_contacts.create(
|
||||
contact: contact,
|
||||
contact_type: type
|
||||
)
|
||||
end
|
||||
|
||||
class << self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue