Merge remote-tracking branch 'origin/master' into fix-registrant-contact-view

This commit is contained in:
Karl Erik Õunapuu 2020-05-04 14:29:42 +03:00
commit 05a8c5f031
133 changed files with 2328 additions and 1182 deletions

View file

@ -14,8 +14,6 @@ class Contact < ApplicationRecord
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
has_many :actions, dependent: :destroy
has_paper_trail class_name: "ContactVersion", meta: { children: :children_log }
attr_accessor :legal_document_id
alias_attribute :kind, :ident_type
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
@ -23,12 +21,14 @@ class Contact < ApplicationRecord
accepts_nested_attributes_for :legal_documents
validates :name, :email, presence: true
validates :street, :city, :zip, :country_code, presence: true, if: 'self.class.address_processing?'
validates :street, :city, :zip, :country_code, presence: true, if: lambda {
self.class.address_processing?
}
validates :phone, presence: true, e164: true, phone: true
validates :email, format: /@/
validates :email, email_format: { message: :invalid }, if: proc { |c| c.email_changed? }
validates :email, email_format: { message: :invalid }, if: proc { |c| c.will_save_change_to_email? }
validates :code,
uniqueness: { message: :epp_id_taken },
@ -37,7 +37,7 @@ class Contact < ApplicationRecord
validates_associated :identifier
validate :validate_html
validate :validate_country_code, if: 'self.class.address_processing?'
validate :validate_country_code, if: -> { self.class.address_processing? }
after_initialize do
self.status_notes = {} if status_notes.nil?