Added pending delete expired email #2786

This commit is contained in:
Priit Tark 2015-07-28 18:07:47 +03:00
parent acb9f2ee08
commit 5883452fa2
6 changed files with 77 additions and 2 deletions

View file

@ -143,4 +143,14 @@ class DomainMailer < ApplicationMailer
subject: "#{I18n.t(:pending_delete_rejected_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_delete_expired_notification(domain)
@domain = domain
# no delivery off control, driggered by cron, no epp request
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
subject: "#{I18n.t(:pending_delete_expired_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
end

View file

@ -184,6 +184,7 @@ class Domain < ActiveRecord::Base
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
@ -198,13 +199,19 @@ class Domain < ActiveRecord::Base
next
end
count += 1
DomainMailer.pending_update_expired_notification_for_new_registrant(domain).deliver_now
if domain.pending_update?
DomainMailer.pending_update_expired_notification_for_new_registrant(domain).deliver_now
end
if domain.pending_delete?
DomainMailer.pending_delete_expired_notification(domain).deliver_now
end
domain.clean_pendings!
STDOUT << "#{Time.zone.now.utc} Domain.clean_expired_pendings: ##{domain.id}\n" unless Rails.env.test?
end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity

View file

@ -0,0 +1,15 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Domain <%= @domain.name %> deletion cancelled.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,15 @@
Tere,
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Domain <%= @domain.name %> deletion cancelled.
Best Regards,
Estonian Internet Foundation