mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Revert "Domain transfer: remove duplicate domain_contacts on transfer"
This commit is contained in:
parent
e5bedc10e9
commit
a0229e5e85
1 changed files with 2 additions and 7 deletions
|
@ -57,8 +57,7 @@ module Concerns::Domain::Transferable
|
||||||
|
|
||||||
def transfer_domain_contacts(new_registrar)
|
def transfer_domain_contacts(new_registrar)
|
||||||
copied_ids = []
|
copied_ids = []
|
||||||
domain_contacts.each do |dc|
|
contacts.each do |contact|
|
||||||
contact = Contact.find(dc.contact_id)
|
|
||||||
next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
|
next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
|
||||||
|
|
||||||
if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
|
if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
|
||||||
|
@ -67,11 +66,7 @@ module Concerns::Domain::Transferable
|
||||||
oc = contact.transfer(new_registrar)
|
oc = contact.transfer(new_registrar)
|
||||||
end
|
end
|
||||||
|
|
||||||
if domain_contacts.find_by(contact_id: oc.id, domain_id: id, type: dc.type).present?
|
domain_contacts.where(contact_id: contact.id).update_all({ contact_id: oc.id }) # n+1 workaround
|
||||||
dc.destroy
|
|
||||||
else
|
|
||||||
dc.update(contact_id: oc.id)
|
|
||||||
end
|
|
||||||
copied_ids << contact.id
|
copied_ids << contact.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue