mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Story#119627029 process history ids even if they are strings
(cherry picked from commit 5cc603d)
This commit is contained in:
parent
b8bc341bee
commit
be75b79c85
2 changed files with 27 additions and 2 deletions
|
@ -86,8 +86,18 @@ class LegalDocument < ActiveRecord::Base
|
|||
|
||||
contact_ids = DomainVersion.where(item_id: orig_legal.documentable_id).distinct.
|
||||
pluck("object->>'registrant_id'", "object_changes->>'registrant_id'",
|
||||
"children->>'tech_contacts'", "children->>'admin_contacts'",
|
||||
"children->>'tech_contacts'", "children->>'admin_contacts'").flatten.uniq
|
||||
contact_ids = contact_ids.map{|id| id.is_a?(Hash) ? id["id"] : id}.flatten.compact.uniq
|
||||
contact_ids = contact_ids.map{|id|
|
||||
case id
|
||||
when Hash
|
||||
id["id"]
|
||||
when String
|
||||
JSON.parse(id) rescue id.to_i
|
||||
else
|
||||
id
|
||||
end
|
||||
}.flatten.compact.uniq
|
||||
LegalDocument.where(documentable_type: "Contact", documentable_id: contact_ids).
|
||||
where(checksum: orig_legal.checksum).where.not(path: orig_legal.path).each do |new_legal|
|
||||
unless modified.include?(orig_legal.id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue