11186739-revert_to_2430bfebf2f5ed3471e88f0b8ed2597b603c96e6

This commit is contained in:
Stas 2016-02-04 16:32:30 +02:00
parent 0141026408
commit 59f7f364ad
2 changed files with 4 additions and 28 deletions

View file

@ -2,7 +2,6 @@ class Contact < ActiveRecord::Base
include Versions # version/contact_version.rb include Versions # version/contact_version.rb
include EppErrors include EppErrors
include UserEvents include UserEvents
has_paper_trail class_name: "ContactVersion", meta: { children: :children_log }
belongs_to :registrar belongs_to :registrar
has_many :domain_contacts has_many :domain_contacts
@ -10,15 +9,11 @@ class Contact < ActiveRecord::Base
has_many :legal_documents, as: :documentable has_many :legal_documents, as: :documentable
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant
attr_accessor :legal_document_id
# TODO: remove later # TODO: remove later
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
accepts_nested_attributes_for :legal_documents accepts_nested_attributes_for :legal_documents
before_save :catch_legal_doc_id
validates :name, :phone, :email, :ident, :ident_type, validates :name, :phone, :email, :ident, :ident_type,
:street, :city, :zip, :country_code, :registrar, presence: true :street, :city, :zip, :country_code, :registrar, presence: true
@ -506,19 +501,4 @@ class Contact < ActiveRecord::Base
related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) } related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) }
end end
def children_log
log = HashWithIndifferentAccess.new
log[:legal_documents]= [legal_document_id]
log
end
def catch_legal_doc_id
if !legal_document_id && doc = self.legal_documents.last.new_record?
legal_document_id = doc.id
end
end
end end

View file

@ -476,7 +476,7 @@ class Epp::Domain < Domain
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
self.legal_document_id = doc.id if doc.id self.legal_document_id = doc.id
end end
at_add = attrs_from(frame.css('add'), current_user, 'add') at_add = attrs_from(frame.css('add'), current_user, 'add')
@ -546,7 +546,6 @@ class Epp::Domain < Domain
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
self.legal_document_id = doc.id if doc.id
end end
if Setting.request_confirmation_on_domain_deletion_enabled && if Setting.request_confirmation_on_domain_deletion_enabled &&
@ -699,8 +698,7 @@ class Epp::Domain < Domain
self.registrar = current_user.registrar self.registrar = current_user.registrar
end end
doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) attach_legal_document(self.class.parse_legal_document_from_frame(frame))
self.legal_document_id = doc.id if doc.id
save!(validate: false) save!(validate: false)
return dt return dt
@ -728,8 +726,7 @@ class Epp::Domain < Domain
generate_auth_info generate_auth_info
self.registrar = pt.transfer_to self.registrar = pt.transfer_to
doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) attach_legal_document(self.class.parse_legal_document_from_frame(frame))
self.legal_document_id = doc.id if doc.id
save!(validate: false) save!(validate: false)
end end
@ -750,8 +747,7 @@ class Epp::Domain < Domain
status: DomainTransfer::CLIENT_REJECTED status: DomainTransfer::CLIENT_REJECTED
) )
doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) attach_legal_document(self.class.parse_legal_document_from_frame(frame))
self.legal_document_id = doc.id if doc.id
save!(validate: false) save!(validate: false)
end end