Add forceDelete on email_verification failed

This commit is contained in:
Alex Sherman 2021-03-17 15:11:20 +05:00
parent 4522e4427e
commit a8e3d67556
4 changed files with 14 additions and 7 deletions

View file

@ -45,6 +45,6 @@ class BouncedMailAddress < ApplicationRecord
end
def force_delete_from_bounce
Domains::ForceDeleteBounce::Base.run(bounced_mail_address: self)
Domains::ForceDeleteEmail::Base.run(email: email)
end
end

View file

@ -1,5 +1,6 @@
class EmailAddressVerification < ApplicationRecord
RECENTLY_VERIFIED_PERIOD = 1.month
after_save :check_force_delete
scope :not_verified_recently, lambda {
where('verified_at IS NULL or verified_at < ?', verification_period)
@ -40,6 +41,12 @@ class EmailAddressVerification < ApplicationRecord
success
end
def check_force_delete
return unless failed?
Domains::ForceDeleteEmail::Base.run(email: email)
end
def verify
validation_request = Truemail.validate(email)