mirror of
https://github.com/internetee/registry.git
synced 2025-06-14 00:24:44 +02:00
Auto-select email template
Chooses template based on domain registrant ident_type. Closes #442
This commit is contained in:
parent
083be0d536
commit
7d6d53e420
4 changed files with 29 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group email-template-row">
|
||||
<label class="col-md-3 control-label"><%= t '.email_template' %></label>
|
||||
<div class="col-md-9">
|
||||
<%= select_tag 'template_name', options_for_select(templates), class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -32,4 +32,4 @@
|
|||
</div>
|
||||
|
||||
<%= render 'form' %>
|
||||
<%= render 'force_delete_dialog', domain: @domain, templates: force_delete_templates %>
|
||||
<%= render 'force_delete_dialog', domain: @domain %>
|
||||
|
|
|
@ -42,6 +42,22 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
|||
find(:css, '#soft_delete').set(true)
|
||||
click_link_or_button 'Force delete domain'
|
||||
end
|
||||
|
||||
@domain.reload
|
||||
assert_equal template_name, @domain.template_name
|
||||
end
|
||||
|
||||
def test_uses_legal_template_if_registrant_org
|
||||
@domain.registrant.update(ident_type: 'org')
|
||||
|
||||
assert_emails 0 do
|
||||
visit edit_admin_domain_url(@domain)
|
||||
find(:css, '#soft_delete').set(true)
|
||||
click_link_or_button 'Force delete domain'
|
||||
end
|
||||
|
||||
@domain.reload
|
||||
assert_equal template_name, @domain.template_name
|
||||
end
|
||||
|
||||
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
||||
|
@ -71,4 +87,10 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
|||
assert_no_button 'Schedule force delete'
|
||||
assert_no_link 'Schedule force delete'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def template_name
|
||||
@domain.registrant.org? ? 'legal_person' : 'private_person'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue