mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +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
|
@ -13,10 +13,12 @@ module Admin
|
|||
search_params[:registrant_domains_id_not_null] = 1
|
||||
end
|
||||
|
||||
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name')
|
||||
contacts = Contact.includes(:registrar).joins(:registrar)
|
||||
.includes(:email_address_verification)
|
||||
.select('contacts.*, registrars.name')
|
||||
contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
||||
|
||||
contacts = contacts.email_not_verified if params[:email_not_verified].eql?('1')
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = contacts.search(search_params)
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -63,6 +63,10 @@
|
|||
.form-group
|
||||
= label_tag :only_no_country_code, "Ident CC missing"
|
||||
= check_box_tag :only_no_country_code, '1',params[:only_no_country_code].eql?('1'), style: 'width:auto;height:auto;float:right'
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag :email_not_verified, "Email not verified"
|
||||
= check_box_tag :email_not_verified, '1',params[:email_not_verified].eql?('1'), style: 'width:auto;height:auto;float:right'
|
||||
|
||||
.row
|
||||
.col-md-3{style: 'padding-top: 25px;float:right;'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue