mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Merge branch '111864739-history_legal_doc' into staging
This commit is contained in:
commit
219eb69671
3 changed files with 24 additions and 9 deletions
|
@ -2,6 +2,7 @@ class Contact < ActiveRecord::Base
|
|||
include Versions # version/contact_version.rb
|
||||
include EppErrors
|
||||
include UserEvents
|
||||
has_paper_trail class_name: "ContactVersion", meta: { children: :children_log }
|
||||
|
||||
belongs_to :registrar
|
||||
has_many :domain_contacts
|
||||
|
@ -9,6 +10,8 @@ class Contact < ActiveRecord::Base
|
|||
has_many :legal_documents, as: :documentable
|
||||
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant
|
||||
|
||||
attr_accessor :legal_document_id
|
||||
|
||||
# TODO: remove later
|
||||
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
|
||||
|
||||
|
@ -506,4 +509,10 @@ class Contact < ActiveRecord::Base
|
|||
RegenerateWhoisRecordJob.enqueue related_domain_descriptions.keys, :name
|
||||
end
|
||||
|
||||
def children_log
|
||||
log = HashWithIndifferentAccess.new
|
||||
log[:legal_documents]= [legal_document_id]
|
||||
log
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -38,7 +38,9 @@ class Epp::Contact < Contact
|
|||
|
||||
legal_frame = f.css('legalDocument').first
|
||||
if legal_frame.present?
|
||||
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
||||
doc = legal_document_attrs(legal_frame)
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
at[:legal_documents_attributes] = doc
|
||||
end
|
||||
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
||||
at
|
||||
|
|
|
@ -194,7 +194,10 @@ class Epp::Domain < Domain
|
|||
end
|
||||
|
||||
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
||||
at[:legal_documents_attributes] = legal_document_from(frame)
|
||||
|
||||
doc = legal_document_from(frame)
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
at[:legal_documents_attributes] = doc
|
||||
at
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
|
@ -476,7 +479,7 @@ class Epp::Domain < Domain
|
|||
|
||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||
self.legal_document_id = doc.id
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
end
|
||||
|
||||
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
||||
|
@ -546,6 +549,7 @@ class Epp::Domain < Domain
|
|||
|
||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
end
|
||||
|
||||
if Setting.request_confirmation_on_domain_deletion_enabled &&
|
||||
|
@ -699,10 +703,8 @@ class Epp::Domain < Domain
|
|||
self.registrar = current_user.registrar
|
||||
end
|
||||
|
||||
attach_legal_document(self.class.parse_legal_document_from_frame(frame))
|
||||
|
||||
# we want to transfer data to new owner at any case.
|
||||
# We also hope that if domain is not valid, new registrar would be better.
|
||||
doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame))
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
save!(validate: false)
|
||||
|
||||
return dt
|
||||
|
@ -730,7 +732,8 @@ class Epp::Domain < Domain
|
|||
generate_auth_info
|
||||
self.registrar = pt.transfer_to
|
||||
|
||||
attach_legal_document(self.class.parse_legal_document_from_frame(frame))
|
||||
doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame))
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
save!(validate: false)
|
||||
end
|
||||
|
||||
|
@ -751,7 +754,8 @@ class Epp::Domain < Domain
|
|||
status: DomainTransfer::CLIENT_REJECTED
|
||||
)
|
||||
|
||||
attach_legal_document(self.class.parse_legal_document_from_frame(frame))
|
||||
doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame))
|
||||
self.legal_document_id = doc.id if doc.id
|
||||
save!(validate: false)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue