mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Added pending delete
This commit is contained in:
parent
50d36cb654
commit
6f59824cd1
13 changed files with 184 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
class DomainMailer < ApplicationMailer
|
||||
def registrant_updated(domain)
|
||||
def registrant_pending_updated(domain)
|
||||
@domain = domain
|
||||
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
|
||||
|
||||
|
@ -22,6 +22,32 @@ class DomainMailer < ApplicationMailer
|
|||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
||||
|
||||
mail(to: @old_registrant.email,
|
||||
subject: "#{I18n.t(:domain_registrant_update_subject, name: @domain.name)} [#{@domain.name}]")
|
||||
subject: "#{I18n.t(:domain_registrant_pending_updated_subject, name: @domain.name)} [#{@domain.name}]")
|
||||
end
|
||||
|
||||
def pending_deleted(domain)
|
||||
@domain = domain
|
||||
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
|
||||
|
||||
# turn on delivery on specific request only, thus rake tasks does not deliver anything
|
||||
return if @domain.deliver_emails != true
|
||||
|
||||
if @domain.registrant_verification_token.blank?
|
||||
logger.warn "EMAIL NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}"
|
||||
return
|
||||
end
|
||||
|
||||
if @domain.registrant_verification_asked_at.blank?
|
||||
logger.warn "EMAIL NOT DELIVERED: registrant_verification_asked_at is missing for #{@domain.name}"
|
||||
return
|
||||
end
|
||||
|
||||
@old_registrant = Registrant.find(@domain.registrant_id_was)
|
||||
|
||||
confirm_path = "#{ENV['registrant_url']}/registrant/domain_delete_confirms"
|
||||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
||||
|
||||
mail(to: @old_registrant.email,
|
||||
subject: "#{I18n.t(:domain_pending_deleted_subject, name: @domain.name)} [#{@domain.name}]")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue