From 057ec6a757ed78d5c7d71f4174fa3d4adb185eb6 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Thu, 17 Dec 2015 14:39:12 +0200 Subject: [PATCH] Story #109367018 - privatize the work method --- app/mailers/domain_mailer.rb | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/mailers/domain_mailer.rb b/app/mailers/domain_mailer.rb index 4963cb02a..66533e316 100644 --- a/app/mailers/domain_mailer.rb +++ b/app/mailers/domain_mailer.rb @@ -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