mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
Clone owner contact if contact has more domains
This commit is contained in:
parent
568121ddd0
commit
33f7920ad8
4 changed files with 16 additions and 4 deletions
|
@ -401,8 +401,14 @@ class Epp::Domain < Domain
|
|||
end
|
||||
|
||||
def transfer_contacts(current_user)
|
||||
if owner_contact.domains.count > 1
|
||||
# create new
|
||||
if owner_contact.domains_owned.count > 1
|
||||
c = Contact.find(owner_contact_id)
|
||||
oc = c.deep_clone include: [:statuses, :address]
|
||||
oc.code = nil
|
||||
oc.registrar_id = current_user.registrar_id
|
||||
oc.save!
|
||||
|
||||
self.owner_contact_id = oc.id
|
||||
else
|
||||
# transfer contact
|
||||
# TODO: This is a workaround so Bullet won't complain about n+1 query
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue