Add nonverified color email to registrar index

This commit is contained in:
Alex Sherman 2020-06-09 15:51:51 +05:00
parent af7e0f266d
commit e95996fa12
7 changed files with 29 additions and 5 deletions

View file

@ -30,6 +30,9 @@ class EmailAddressVerification < ApplicationRecord
if validation_request.result.success
update(verified_at: Time.zone.now,
success: true)
else
update(verified_at: nil,
success: false)
end
validation_request.result.success

View file

@ -13,6 +13,14 @@ class Registrar < ApplicationRecord
has_many :nameservers, through: :domains
has_many :whois_records
has_many :white_ips, dependent: :destroy
belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
primary_key: 'email',
foreign_key: 'email',
optional: true
belongs_to :billing_email_address_verification, class_name: 'EmailAddressVerification',
primary_key: 'email',
foreign_key: 'billing_email',
optional: true
delegate :balance, to: :cash_account, allow_nil: true

View file

@ -28,6 +28,9 @@
<th class="col-xs-4">
<%= t(:test_registrar) %>
</th>
<th class="col-xs-4">
<%= t(:emails) %>
</th>
</tr>
</thead>
<tbody>
@ -45,6 +48,16 @@
<td>
<%= "#{x.test_registrar}" %>
</td>
<td>
<span class=<%= 'text-danger' unless x.email_address_verification.success %>>
<%= "#{x.email}" %>
</span>
<% if x[:billing_email].present? %>
<span class=<%= 'text-danger' unless x.billing_email_address_verification.success %>>
<%= "#{x[:billing_email]}" %>
</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>

View file

@ -636,6 +636,7 @@ en:
edit_dispute: 'Edit dispute'
optional: 'Optional'
test_registrar: "Test registrar"
emails: 'Email addresses'
verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?'
verified: 'Verified'
deleted: 'Deleted'

View file

@ -5,3 +5,4 @@ et:
date:
# Don't forget the nil at the beginning; there's no such thing as a 0th month
month_names: [~, Jaanuar, Veebruar, Märts, Aprill, Mai, Juuni, Juuli, August, September, Oktoober, November, Detsember]
emails: "Meillaadressid"

View file

@ -4,12 +4,11 @@ class FillEmailVerifications < ActiveRecord::Migration[6.0]
registrar_emails = Registrar.pluck(:email).uniq.reject(&:blank?)
contact_emails = Contact.pluck(:email).uniq.reject(&:blank?)
emails = (contact_emails || registrar_emails || registrar_billing_emails).uniq
emails = (contact_emails + registrar_emails + registrar_billing_emails).uniq
result = emails.map do |email|
{ email: email, domain: domain(email) }
end
EmailAddressVerification.import result, batch_size: 500
end

View file

@ -2,13 +2,12 @@ namespace :verify_email do
desc 'Stars verifying email jobs'
task all_domains: :environment do
verifications_by_domain = EmailAddressVerification.not_verified_recently.group_by(&:domain)
verifications_by_domain.each do |domain, verifications|
next if domain == 'not_found'
ver = verifications[0] # Only first email to not to clog the SMTP servers
ver = verifications.sample # Verify random email to not to clog the SMTP servers
VerifyEmailsJob.enqueue(ver.id)
# VerifyEmailsJob.run(ver.id)
next
end
end
end