Allow skipping email notification on domain force delete

#727
This commit is contained in:
Artur Beljajev 2018-02-24 13:05:04 +02:00
parent a49b592fac
commit b5870d3eb5
4 changed files with 34 additions and 2 deletions

View file

@ -68,7 +68,7 @@ module Admin
@domain.transaction do
@domain.schedule_force_delete
@domain.registrar.messages.create!(body: I18n.t('force_delete_set_on_domain', domain_name: @domain.name))
DomainDeleteForcedEmailJob.enqueue(@domain.id, params[:template_name])
DomainDeleteForcedEmailJob.enqueue(@domain.id, params[:template_name]) if notify_by_email?
end
redirect_to edit_admin_domain_url(@domain), notice: t('.scheduled')
@ -132,5 +132,9 @@ module Admin
def force_delete_templates
%w(removed_company death)
end
def notify_by_email?
ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:notify_by_email])
end
end
end

View file

@ -12,6 +12,17 @@
<div class="row">
<%= form_tag schedule_force_delete_admin_domain_path, method: :patch,
id: 'domain-force-delete-form', class: 'form-horizontal' do %>
<div class="form-group">
<div class="col-sm-9 col-md-offset-2">
<div class="checkbox">
<label>
<%= check_box_tag 'notify_by_email', 1, true %>
<%= t '.notify_by_email' %>
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"><%= t '.template' %>:</label>
<div class="col-sm-9">