Merge branch 'master' into log-bounced-emails

This commit is contained in:
Karl Erik Õunapuu 2020-12-04 13:46:48 +02:00 committed by GitHub
commit 4adc240b0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
141 changed files with 3748 additions and 1214 deletions

View file

@ -4,26 +4,15 @@ module Admin
def create
authorize! :manage, domain
notice = t('.scheduled')
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))
notify_by_email if notify_by_email?
result = domain.schedule_force_delete(type: force_delete_type,
notify_by_email: notify_by_email?)
notice = result.errors.messages[:domain].first unless result.valid?
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
redirect_to edit_admin_domain_url(domain), notice: notice
end
def destroy
@ -42,13 +31,6 @@ 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

View file

@ -2,7 +2,6 @@ module Admin
class DomainsController < BaseController
before_action :set_domain, only: %i[show edit update keep]
authorize_resource
helper_method :force_delete_templates
def index
params[:q] ||= {}
@ -105,9 +104,5 @@ module Admin
params[:q][:valid_to_lteq] = ca_cache
end
def force_delete_templates
DomainDeleteMailer.force_delete_templates
end
end
end