mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
Merge pull request #2010 from internetee/domain_version_legacy_id_issue
added fix for contact versions
This commit is contained in:
commit
07da360a5a
2 changed files with 6 additions and 3 deletions
|
@ -67,7 +67,9 @@
|
||||||
- else
|
- else
|
||||||
- contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first
|
- contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first
|
||||||
- if contact.nil? && ver = Version::ContactVersion.where(item_id: domain.registrant_id).last
|
- if contact.nil? && ver = Version::ContactVersion.where(item_id: domain.registrant_id).last
|
||||||
- contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}) {|(k,v), o| o[k] = v.last }))
|
- merged_obj = ver.object_changes.to_h.each_with_object({}) {|(k,v), o| o[k] = v.last }
|
||||||
|
- result = ver.object.to_h.merge(merged_obj)&.slice(*Contact&.column_names)
|
||||||
|
- contact = Contact.new(result)
|
||||||
= contact.try(:name)
|
= contact.try(:name)
|
||||||
= " ".html_safe
|
= " ".html_safe
|
||||||
= "(#{t(:deleted)})"
|
= "(#{t(:deleted)})"
|
||||||
|
|
|
@ -24,8 +24,9 @@ class ContactVersionsTest < ApplicationSystemTestCase
|
||||||
INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object,
|
INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object,
|
||||||
object_changes, created_at, session, children, ident_updated_at, uuid)
|
object_changes, created_at, session, children, ident_updated_at, uuid)
|
||||||
VALUES ('Contact', 75, 'update', '1-AdminUser',
|
VALUES ('Contact', 75, 'update', '1-AdminUser',
|
||||||
'{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": #{@registrar.id}, "old_field": "value"}',
|
'{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": #{@registrar.id}, "old_field": "value",
|
||||||
'{"other_made_up_field": "value"}',
|
"legal_id": "123"}',
|
||||||
|
'{"other_made_up_field": "value"}',
|
||||||
'2018-04-23 15:50:48.113491', '2018-04-23 12:44:56',
|
'2018-04-23 15:50:48.113491', '2018-04-23 12:44:56',
|
||||||
'{"legal_documents":[null]}', null, null
|
'{"legal_documents":[null]}', null, null
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue