mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Fix tests & interactor process
This commit is contained in:
parent
03754b542b
commit
f97dff6002
14 changed files with 93 additions and 182 deletions
|
@ -5,29 +5,12 @@ module Admin
|
|||
authorize! :manage, domain
|
||||
|
||||
domain.transaction do
|
||||
# domain.schedule_force_delete(type: force_delete_type)
|
||||
# domain.registrar.notifications.create!(text: t('force_delete_set_on_domain',
|
||||
# domain_name: domain.name,
|
||||
# outzone_date: domain.outzone_date,
|
||||
# purge_date: domain.purge_date)) # added to interactor
|
||||
#
|
||||
# notify_by_email if notify_by_email? # added to interactor
|
||||
Domain::ForceDelete::Base.call(domain: domain, type: force_delete_type)
|
||||
domain.schedule_force_delete(type: force_delete_type, notify_by_email: notify_by_email?)
|
||||
end
|
||||
|
||||
redirect_to edit_admin_domain_url(domain), notice: t('.scheduled')
|
||||
end
|
||||
|
||||
def notify_by_email
|
||||
# added to interactor
|
||||
if force_delete_type == :fast_track
|
||||
send_email
|
||||
domain.update(contact_notification_sent_date: Time.zone.today)
|
||||
else
|
||||
domain.update(template_name: domain.notification_template)
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
authorize! :manage, domain
|
||||
domain.cancel_force_delete
|
||||
|
@ -41,18 +24,9 @@ module Admin
|
|||
end
|
||||
|
||||
def notify_by_email?
|
||||
# added to interactor
|
||||
ActiveRecord::Type::Boolean.new.cast(params[:notify_by_email])
|
||||
end
|
||||
|
||||
def send_email
|
||||
# added to interactor
|
||||
DomainDeleteMailer.forced(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant,
|
||||
template_name: domain.notification_template).deliver_now
|
||||
end
|
||||
|
||||
def force_delete_type
|
||||
soft_delete? ? :soft : :fast_track
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue