Merge remote-tracking branch 'origin/master' into repp-domains

This commit is contained in:
Karl Erik Õunapuu 2021-01-28 16:18:45 +02:00
commit 43e5b74668
No known key found for this signature in database
GPG key ID: C9DD647298A34764
29 changed files with 357 additions and 49 deletions

View file

@ -39,13 +39,15 @@ module Concerns
def release
if release_to_auction
transaction do
domain_name.sell_at_auction if domain_name.auctionable?
destroy!
registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}",
attached_obj_id: id,
attached_obj_type: self.class)
end
ToStdout.msg 'Destroying domain'
destroy!
ToStdout.msg "Checking if domain_name is auctionable: #{domain_name.auctionable?}"
domain_name.sell_at_auction if domain_name.auctionable?
ToStdout.msg 'Sending registrar notification'
registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}",
attached_obj_id: id,
attached_obj_type: self.class)
else
discard
end

View file

@ -59,7 +59,7 @@ module Concerns::Domain::Transferable
copied_ids = []
domain_contacts.each do |dc|
contact = Contact.find(dc.contact_id)
next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
next if copied_ids.include?(uniq_contact_hash(dc)) || contact.registrar == new_registrar
if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
oc = OpenStruct.new(id: registrant_id)
@ -72,7 +72,11 @@ module Concerns::Domain::Transferable
else
dc.update(contact_id: oc.id)
end
copied_ids << contact.id
copied_ids << uniq_contact_hash(dc)
end
end
def uniq_contact_hash(contact)
Digest::SHA1.hexdigest(contact.contact_id.to_s + contact.type)
end
end