Added multiple domain emails #2786

This commit is contained in:
Priit Tark 2015-07-28 17:32:14 +03:00
parent 00d42ef3c4
commit 8a92591df7
18 changed files with 243 additions and 47 deletions

View file

@ -1,5 +1,5 @@
class DomainMailer < ApplicationMailer
def pending_update_old_registrant_request(domain)
def pending_update_request_for_old_registrant(domain)
@domain = domain
return if delivery_off?(@domain)
@ -20,11 +20,11 @@ class DomainMailer < ApplicationMailer
return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email,
subject: "#{I18n.t(:pending_update_old_registrant_request_subject,
subject: "#{I18n.t(:pending_update_request_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_update_new_registrant_notification(domain)
def pending_update_notification_for_new_registrant(domain)
@domain = domain
return if delivery_off?(@domain)
@ -43,21 +43,33 @@ class DomainMailer < ApplicationMailer
return if whitelist_blocked?(@new_registrant.email)
mail(to: @new_registrant.email,
subject: "#{I18n.t(:pending_update_new_registrant_notification_subject,
subject: "#{I18n.t(:pending_update_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def registrant_updated(domain)
def registrant_updated_notification_for_new_registrant(domain)
@domain = domain
return if delivery_off?(@domain)
return if whitelist_blocked?(@domain.registrant_email)
mail(to: @domain.registrant_email,
subject: "#{I18n.t(:domain_registrant_updated,
subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_update_rejected_new_registrant_notification(domain)
def registrant_updated_notification_for_old_registrant(domain)
@domain = domain
return if delivery_off?(@domain)
@old_registrant_email = domain.registrant_email # Nb! before applying pending updates
return if whitelist_blocked?(@old_registrant_email)
mail(to: @old_registrant_email,
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_update_rejected_notification_for_new_registrant(domain)
@domain = domain
# no delivery off control, driggered by que, no epp request
@ -66,7 +78,24 @@ class DomainMailer < ApplicationMailer
return if whitelist_blocked?(@new_registrant_email)
mail(to: @new_registrant_email,
subject: "#{I18n.t(:pending_update_rejected_new_registrant_notification_subject,
subject: "#{I18n.t(:pending_update_rejected_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_update_expired_notification_for_new_registrant(domain)
@domain = domain
# no delivery off control, driggered by cron, no epp request
@new_registrant_email = @domain.pending_json[:new_registrant_email]
@new_registrant_name = @domain.pending_json[:new_registrant_name]
return if whitelist_blocked?(@new_registrant_email)
if @new_registrant_email.blank?
logger.info "EMAIL NOT DELIVERED: no registrant email [pending_update_expired_notification_for_new_registrant]"
return
end
mail(to: @new_registrant_email,
subject: "#{I18n.t(:pending_update_expired_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end