Story #109367018 - add new model to handle domain values are changing, and need to be captured now, not later

New model will provide data to DomainMailer customized as needed for the invocation reason as passed via symbol to
send_mail(). The mail templetes then required modification to use the new data model. This should handle all the data
errors in the update process, including pendingUpdate, confirmed, rejected or expired.
This commit is contained in:
Matt Farnsworth 2015-12-16 16:14:05 +02:00
parent 2c916001ad
commit 51a5798914
17 changed files with 366 additions and 254 deletions

View file

@ -239,7 +239,7 @@ class Domain < ActiveRecord::Base
end
count += 1
if domain.pending_update?
DomainMailer.pending_update_expired_notification_for_new_registrant(domain.id).deliver
send_mail :pending_update_expired_notification_for_new_registrant
end
if domain.pending_delete? || domain.pending_delete_confirmation?
DomainMailer.pending_delete_expired_notification(domain.id, true).deliver
@ -451,8 +451,8 @@ class Domain < ActiveRecord::Base
new_registrant_email = registrant.email
new_registrant_name = registrant.name
DomainMailer.pending_update_request_for_old_registrant(id, registrant_id_was, deliver_emails).deliver
DomainMailer.pending_update_notification_for_new_registrant(id, registrant_id_was, deliver_emails).deliver
send_mail :pending_update_request_for_old_registrant
send_mail :pending_update_notification_for_new_registrant
reload # revert back to original
@ -818,5 +818,10 @@ class Domain < ActiveRecord::Base
status_notes[status] = notes[i]
end
end
def send_mail(action)
DomainMailer.send(action, DomainMailModel.new(self).send(action)).deliver
end
end
# rubocop: enable Metrics/ClassLength