mirror of
https://github.com/internetee/registry.git
synced 2025-08-11 12:09:34 +02:00
returned back missing peace of code from #2349 branch
This commit is contained in:
parent
693d1c5747
commit
6c66ba7383
5 changed files with 24 additions and 1 deletions
|
@ -34,7 +34,13 @@ module Domain::ForceDelete
|
||||||
reason = explicit&.downcase
|
reason = explicit&.downcase
|
||||||
return reason if %w[invalid_email invalid_phone].include?(reason)
|
return reason if %w[invalid_email invalid_phone].include?(reason)
|
||||||
|
|
||||||
registrant.org? ? 'legal_person' : 'private_person'
|
if contact_emails_verification_failed.present?
|
||||||
|
'invalid_email'
|
||||||
|
elsif registrant.org?
|
||||||
|
'legal_person'
|
||||||
|
else
|
||||||
|
'private_person'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def force_delete_scheduled?
|
def force_delete_scheduled?
|
||||||
|
|
|
@ -5,6 +5,10 @@ module EmailVerifable
|
||||||
scope :recently_not_validated, -> { where.not(id: ValidationEvent.validated_ids_by(name)) }
|
scope :recently_not_validated, -> { where.not(id: ValidationEvent.validated_ids_by(name)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def email_verification_failed?
|
||||||
|
need_to_start_force_delete?
|
||||||
|
end
|
||||||
|
|
||||||
def validate_email_data(level:, count:)
|
def validate_email_data(level:, count:)
|
||||||
validation_events.order(created_at: :desc).limit(count).all? do |event|
|
validation_events.order(created_at: :desc).limit(count).all? do |event|
|
||||||
event.check_level == level.to_s && event.failed?
|
event.check_level == level.to_s && event.failed?
|
||||||
|
|
|
@ -24,6 +24,11 @@ class Contact < ApplicationRecord
|
||||||
alias_attribute :kind, :ident_type
|
alias_attribute :kind, :ident_type
|
||||||
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
|
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
|
||||||
|
|
||||||
|
scope :email_verification_failed, lambda {
|
||||||
|
joins('LEFT JOIN email_address_verifications emv ON contacts.email = emv.email')
|
||||||
|
.where('success = false and verified_at IS NOT NULL')
|
||||||
|
}
|
||||||
|
|
||||||
scope :with_different_company_name, (lambda do |company|
|
scope :with_different_company_name, (lambda do |company|
|
||||||
where("ident = ? AND ident_country_code = 'EE' AND name != ?",
|
where("ident = ? AND ident_country_code = 'EE' AND name != ?",
|
||||||
company.registration_number,
|
company.registration_number,
|
||||||
|
|
|
@ -725,6 +725,10 @@ class Domain < ApplicationRecord
|
||||||
DNS::DomainName.new(name)
|
DNS::DomainName.new(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contact_emails_verification_failed
|
||||||
|
contacts.select(&:email_verification_failed?)&.map(&:email)&.uniq
|
||||||
|
end
|
||||||
|
|
||||||
def as_csv_row
|
def as_csv_row
|
||||||
[
|
[
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -52,6 +52,10 @@ class DomainPresenter
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contact_emails_verification_failed
|
||||||
|
domain.contact_emails_verification_failed.join(', ')
|
||||||
|
end
|
||||||
|
|
||||||
def remove_registry_lock_btn
|
def remove_registry_lock_btn
|
||||||
return unless domain.locked_by_registrant?
|
return unless domain.locked_by_registrant?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue