mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +02:00
Story #109367694 - let cr_id try creator string before searching history, because it did that before. TODO: performance test and maybe reverse that order
This commit is contained in:
parent
27482495d8
commit
d631290598
1 changed files with 18 additions and 7 deletions
|
@ -1,15 +1,26 @@
|
|||
module UserEvents
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
# EPP requires a server defined creator ID, which should be registrar code if we have one
|
||||
def cr_id
|
||||
if versions.first.object.nil?
|
||||
cr_registrar_id =versions.first.object_changes['registrar_id'].second
|
||||
# try this, rebuild user for registrar before searching history? really?
|
||||
registrar = self.creator.try(:registrar)
|
||||
if registrar.present? # Did creator return a kind of User that has a registrar?
|
||||
registrar.code
|
||||
else
|
||||
# untested, expected never to execute
|
||||
cr_registrar_id = versions.first.object['registrar_id']
|
||||
end
|
||||
if cr_registrar_id.present?
|
||||
Registrar.find(cr_registrar_id).code
|
||||
if versions.first.object.nil?
|
||||
cr_registrar_id =versions.first.object_changes['registrar_id'].second
|
||||
else
|
||||
# untested, expected never to execute
|
||||
cr_registrar_id = versions.first.object['registrar_id']
|
||||
end
|
||||
|
||||
if cr_registrar_id.present?
|
||||
Registrar.find(cr_registrar_id).code
|
||||
else
|
||||
# cr_id optional for domain, but required for contact; but we want something here anyway
|
||||
self.creator_str # Fallback if we failed, maybe we can find a string here
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue