mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
Add mail notification on soft force delete
This commit is contained in:
parent
9916ca52cb
commit
c252d801f9
10 changed files with 97 additions and 34 deletions
|
@ -9,17 +9,21 @@ module Admin
|
|||
domain.registrar.notifications.create!(text: t('force_delete_set_on_domain',
|
||||
domain_name: domain.name))
|
||||
|
||||
if notify_by_email?
|
||||
DomainDeleteMailer.forced(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant,
|
||||
template_name: params[:template_name]).deliver_now
|
||||
end
|
||||
notify_by_email if notify_by_email?
|
||||
end
|
||||
|
||||
redirect_to edit_admin_domain_url(domain), notice: t('.scheduled')
|
||||
end
|
||||
|
||||
def notify_by_email
|
||||
if force_delete_type == :fast_track
|
||||
send_email
|
||||
domain.update(contact_notification_sent_date: Time.zone.today)
|
||||
else
|
||||
domain.update(template_name: params[:template_name])
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
authorize! :manage, domain
|
||||
domain.cancel_force_delete
|
||||
|
@ -36,6 +40,13 @@ module Admin
|
|||
ActiveRecord::Type::Boolean.new.cast(params[:notify_by_email])
|
||||
end
|
||||
|
||||
def send_email
|
||||
DomainDeleteMailer.forced(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant,
|
||||
template_name: params[:template_name]).deliver_now
|
||||
end
|
||||
|
||||
def force_delete_type
|
||||
soft_delete? ? :soft : :fast_track
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue