Add notification on autoFD

This commit is contained in:
Alex Sherman 2021-03-22 14:21:08 +05:00
parent 81c21db392
commit 91093b274d
6 changed files with 42 additions and 10 deletions

View file

@ -13,6 +13,9 @@ module Domains
string :reason,
default: nil,
description: 'Which mail template to use explicitly'
string :email,
default: nil,
description: 'Possible invalid email to notify on'
validates :type, inclusion: { in: %i[fast_track soft] }
end

View file

@ -2,11 +2,23 @@ module Domains
module ForceDelete
class NotifyRegistrar < Base
def execute
email.present? ? notify_with_email : notify_without_email
end
def notify_without_email
domain.registrar.notifications.create!(text: I18n.t('force_delete_set_on_domain',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date))
end
def notify_with_email
domain.registrar.notifications.create!(text: I18n.t('force_delete_auto_email',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date,
email: email))
end
end
end
end