mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Add non-verified email filreting in contact index
This commit is contained in:
parent
48036c660d
commit
af7e0f266d
3 changed files with 17 additions and 2 deletions
|
@ -16,6 +16,10 @@ class Contact < ApplicationRecord
|
|||
has_many :legal_documents, as: :documentable
|
||||
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
|
||||
has_many :actions, dependent: :destroy
|
||||
belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
|
||||
primary_key: 'email',
|
||||
foreign_key: 'email',
|
||||
optional: true
|
||||
|
||||
attr_accessor :legal_document_id
|
||||
alias_attribute :kind, :ident_type
|
||||
|
@ -23,6 +27,11 @@ class Contact < ApplicationRecord
|
|||
|
||||
accepts_nested_attributes_for :legal_documents
|
||||
|
||||
scope :email_not_verified, lambda {
|
||||
joins(:email_address_verification)
|
||||
.where('verified_at IS NULL OR verified_at <= ?', EmailAddressVerification.verification_period)
|
||||
}
|
||||
|
||||
validates :name, :email, presence: true
|
||||
validates :street, :city, :zip, :country_code, presence: true, if: lambda {
|
||||
self.class.address_processing?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue