mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +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
|
module UserEvents
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# EPP requires a server defined creator ID, which should be registrar code if we have one
|
||||||
def cr_id
|
def cr_id
|
||||||
if versions.first.object.nil?
|
# try this, rebuild user for registrar before searching history? really?
|
||||||
cr_registrar_id =versions.first.object_changes['registrar_id'].second
|
registrar = self.creator.try(:registrar)
|
||||||
|
if registrar.present? # Did creator return a kind of User that has a registrar?
|
||||||
|
registrar.code
|
||||||
else
|
else
|
||||||
# untested, expected never to execute
|
if versions.first.object.nil?
|
||||||
cr_registrar_id = versions.first.object['registrar_id']
|
cr_registrar_id =versions.first.object_changes['registrar_id'].second
|
||||||
end
|
else
|
||||||
if cr_registrar_id.present?
|
# untested, expected never to execute
|
||||||
Registrar.find(cr_registrar_id).code
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue