Story #109367018 - privatize the work method

This commit is contained in:
Matt Farnsworth 2015-12-17 14:39:12 +02:00
parent 702206b9c0
commit 057ec6a757

View file

@ -25,19 +25,6 @@ class DomainMailer < ApplicationMailer
compose_from(params)
end
# app/models/DomainMailModel provides the data for mail that can be composed_from
# which ensures that values of objects are captured when they are valid, not later when this method is executed
def compose_from(params)
@params = params
return if delivery_off?(params, params[:deliver_emails])
return if whitelist_blocked?(params[:recipient])
params[:errors].map do |error|
logger.warn error
return
end
mail(to: params[:recipient], subject: params[:subject])
end
def pending_deleted(domain_id, old_registrant_id, should_deliver)
@domain = Domain.find_by(id: domain_id)
@old_registrant = Registrant.find(old_registrant_id)
@ -129,4 +116,18 @@ class DomainMailer < ApplicationMailer
subject: "#{I18n.t(:force_delete_subject)}"
)
end
private
# app/models/DomainMailModel provides the data for mail that can be composed_from
# which ensures that values of objects are captured when they are valid, not later when this method is executed
def compose_from(params)
@params = params
return if delivery_off?(params, params[:deliver_emails])
return if whitelist_blocked?(params[:recipient])
params[:errors].map do |error|
logger.warn error
return
end
mail(to: params[:recipient], subject: params[:subject])
end
end