mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Fix deprecated email_notification usage in tests
This commit is contained in:
parent
d48b0f4401
commit
70a6a44525
12 changed files with 15 additions and 164 deletions
|
@ -9,8 +9,7 @@ module Actions
|
|||
end
|
||||
|
||||
def call
|
||||
parsed_email = EmailAddressConverter.punycode_to_unicode(email)
|
||||
result = check_email(parsed_email)
|
||||
result = check_email(email)
|
||||
save_result(result)
|
||||
result.success ? log_success : log_failure(result)
|
||||
result.success
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
class EmailAddressVerification < ApplicationRecord
|
||||
RECENTLY_VERIFIED_PERIOD = 1.month
|
||||
# after_save :check_force_delete
|
||||
|
||||
def failed?
|
||||
bounce_present? || (verified_at.present? && !success)
|
||||
end
|
||||
|
||||
def verified?
|
||||
success
|
||||
end
|
||||
|
||||
def bounce_present?
|
||||
BouncedMailAddress.find_by(email: email).present?
|
||||
end
|
||||
|
||||
def check_force_delete
|
||||
return unless failed?
|
||||
|
||||
Domains::ForceDeleteEmail::Base.run(email: email)
|
||||
end
|
||||
|
||||
def verify
|
||||
validation_request = Truemail.validate(email)
|
||||
|
||||
if validation_request.result.success
|
||||
update(verified_at: Time.zone.now,
|
||||
success: true)
|
||||
else
|
||||
update(verified_at: Time.zone.now,
|
||||
success: false)
|
||||
end
|
||||
|
||||
validation_request.result
|
||||
end
|
||||
end
|
|
@ -6,7 +6,7 @@
|
|||
# For email_validation event kind also check_level (regex/mx/smtp) is stored in the event_data
|
||||
class ValidationEvent < ApplicationRecord
|
||||
enum event_type: ValidationEvent::EventType::TYPES, _suffix: true
|
||||
VALIDATION_PERIOD = 1.month.ago.freeze
|
||||
VALIDATION_PERIOD = 1.month.freeze
|
||||
VALID_CHECK_LEVELS = %w[regex mx smtp].freeze
|
||||
VALID_EVENTS_COUNT_THRESHOLD = 5
|
||||
|
||||
|
@ -26,7 +26,7 @@ class ValidationEvent < ApplicationRecord
|
|||
|
||||
belongs_to :validation_eventable, polymorphic: true
|
||||
|
||||
scope :recent, -> { where('created_at > ?', VALIDATION_PERIOD) }
|
||||
scope :recent, -> { where('created_at > ?', Time.zone.now - VALIDATION_PERIOD) }
|
||||
scope :successful, -> { where(success: true) }
|
||||
scope :failed, -> { where(success: false) }
|
||||
scope :regex, -> { where('event_data @> ?', { 'check_level': 'regex' }.to_json) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue