Auto-select email template

Chooses template based on domain registrant ident_type.
Closes #442
This commit is contained in:
Alex Sherman 2020-11-02 15:47:00 +05:00
parent 083be0d536
commit 7d6d53e420
4 changed files with 29 additions and 9 deletions

View file

@ -22,7 +22,7 @@ module Admin
send_email
domain.update(contact_notification_sent_date: Time.zone.today)
else
domain.update(template_name: params[:template_name])
domain.update(template_name: template_name)
end
end
@ -34,6 +34,10 @@ module Admin
private
def template_name
domain.registrant.org? ? 'legal_person' : 'private_person'
end
def domain
@domain ||= Domain.find(params[:domain_id])
end
@ -46,7 +50,7 @@ module Admin
DomainDeleteMailer.forced(domain: domain,
registrar: domain.registrar,
registrant: domain.registrant,
template_name: params[:template_name]).deliver_now
template_name: template_name).deliver_now
end
def force_delete_type