emails: remove "Valid?" search option.
No longer necessary after running previous commit because all invalid email addresses have been purged.
This commit is contained in:
@@ -5,7 +5,6 @@ module EmailValidator
|
||||
|
||||
# https://www.regular-expressions.info/email.html
|
||||
EMAIL_REGEX = /\A[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\z/
|
||||
POSTGRES_EMAIL_REGEX = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
|
||||
|
||||
IGNORE_DOTS = %w[gmail.com]
|
||||
IGNORE_PLUS_ADDRESSING = %w[gmail.com hotmail.com outlook.com live.com]
|
||||
|
||||
@@ -45,21 +45,10 @@ class EmailAddress < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.valid(valid = true)
|
||||
if valid.to_s.truthy?
|
||||
where_regex(:address, EmailValidator::POSTGRES_EMAIL_REGEX.to_s)
|
||||
elsif valid.to_s.falsy?
|
||||
where_not_regex(:address, EmailValidator::POSTGRES_EMAIL_REGEX.to_s)
|
||||
else
|
||||
all
|
||||
end
|
||||
end
|
||||
|
||||
def self.search(params)
|
||||
q = search_attributes(params, :id, :created_at, :updated_at, :user, :address, :normalized_address, :is_verified, :is_deliverable)
|
||||
|
||||
q = q.restricted(params[:is_restricted])
|
||||
q = q.valid(params[:is_valid])
|
||||
q = q.apply_default_order(params)
|
||||
|
||||
q
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
<%= f.input :address_ilike, label: "Address", input_html: { value: params[:search][:address_ilike] }, hint: "Use * for wildcard" %>
|
||||
<%= f.input :normalized_address_ilike, label: "Normalized Address", input_html: { value: params[:search][:normalized_address_ilike] }, hint: "Use * for wildcard" %>
|
||||
<%= f.input :is_valid, label: "Valid?", as: :select, include_blank: true, selected: params[:search][:is_valid] %>
|
||||
<%= f.input :is_verified, label: "Verified?", as: :select, include_blank: true, selected: params[:search][:is_verified] %>
|
||||
<%= f.input :is_restricted, label: "Restricted?", as: :select, include_blank: true, selected: params[:search][:is_restricted] %>
|
||||
<%= f.submit "Search" %>
|
||||
@@ -25,11 +24,6 @@
|
||||
<%= link_to email.normalized_address, emails_path(search: { normalized_address_ilike: email.normalized_address }) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Valid?" do |email| %>
|
||||
<% if !email.is_valid? %>
|
||||
<%= link_to "No", emails_path(search: { is_valid: false }) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Restricted?" do |email| %>
|
||||
<% if email.is_restricted? %>
|
||||
<%= link_to "Yes", emails_path(search: { is_restricted: true }) %>
|
||||
|
||||
Reference in New Issue
Block a user