Refactor domain mailer views

#180
This commit is contained in:
Artur Beljajev 2016-11-14 01:35:47 +02:00
parent a6de3761c5
commit 2c3dbc6e32
31 changed files with 361 additions and 153 deletions

View file

@ -380,12 +380,12 @@ class Domain < ActiveRecord::Base
new_registrant_name = registrant.name
current_registrant = Registrant.find(registrant_id_was)
RegistrantChangeMailer.confirmation(domain: self, current_registrant: current_registrant).deliver
RegistrantChangeMailer.confirm(domain: self, registrar: registrar, current_registrant: current_registrant,
new_registrant: registrant).deliver
RegistrantChangeMailer.notice(domain: self, registrar: registrar, current_registrant: current_registrant,
new_registrant: registrant).deliver
send_mail :pending_update_request_for_old_registrant
send_mail :pending_update_notification_for_new_registrant
reload # revert back to original
reload
self.pending_json = pending_json_cache
self.registrant_verification_token = token
@ -397,8 +397,8 @@ class Domain < ActiveRecord::Base
pending_json['new_registrant_name'] = new_registrant_name
# This pending_update! method is triggered by before_update
# Note, all before_save callbacks are excecuted before before_update,
# thus automatic statuses has already excectued by this point
# Note, all before_save callbacks are executed before before_update,
# thus automatic statuses has already executed by this point
# and we need to trigger automatic statuses manually (second time).
manage_automatic_statuses
end
@ -741,6 +741,10 @@ class Domain < ActiveRecord::Base
admin_contact_emails << registrant_email
end
def new_registrant_email
pending_json['new_registrant_email']
end
def self.to_csv
CSV.generate do |csv|
csv << column_names

View file

@ -6,30 +6,6 @@ class DomainMailModel
@params = {errors: [], deliver_emails: domain.deliver_emails, id: domain.id}
end
def pending_update_request_for_old_registrant
registrant_old
subject(:pending_update_request_for_old_registrant_subject)
confirm_update
domain_info
compose
end
def pending_update_notification_for_new_registrant
registrant # new registrant at this point
subject(:pending_update_notification_for_new_registrant_subject)
domain_info
compose
end
def pending_update_rejected_notification_for_new_registrant
registrant_pending
subject(:pending_update_rejected_notification_for_new_registrant_subject)
@params[:deliver_emails] = true # triggered from que
@params[:registrar_name] = @domain.registrar.name
compose
end
def pending_update_expired_notification_for_new_registrant
registrant_pending
subject(:pending_update_expired_notification_for_new_registrant_subject)