mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Added pending delete expired email #2786
This commit is contained in:
parent
acb9f2ee08
commit
5883452fa2
6 changed files with 77 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -785,6 +785,7 @@ en:
|
|||
registrant_updated_notification_for_old_registrant_subject: 'Domeeni %{name} registreerija vahetus teostatud / Registrant change of %{name} has been finished.'
|
||||
domain_pending_deleted_subject: "Kinnitustaotlus domeeni %{name} kustutamiseks .ee registrist / Application for approval for deletion of %{name}"
|
||||
pending_delete_rejected_notification_subject: "Domeeni %{name} kustutamise taotlus tagasi lükatud / %{name) deletion declined"
|
||||
pending_delete_expired_notification_subject: "Domeeni %{name} kustutamise taotlus on tühistatud / %{name} deletion cancelled"
|
||||
whois: WHOIS
|
||||
login_failed_check_id_card: 'Log in failed, check ID card'
|
||||
not_valid_domain_verification_title: Domain verification not available
|
||||
|
|
|
@ -249,7 +249,7 @@ describe DomainMailer do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'email pending delete notification' do
|
||||
describe 'pending delete rejected notification' do
|
||||
before :all do
|
||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||
@domain = Fabricate(:domain, name: 'delete-pending-rejected.ee', registrant: @registrant)
|
||||
|
@ -275,4 +275,31 @@ describe DomainMailer do
|
|||
@mail.body.encoded.should =~ /deletion rejected/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pending delete rejected notification' do
|
||||
before :all do
|
||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||
@domain = Fabricate(:domain, name: 'delete-pending-expired.ee', registrant: @registrant)
|
||||
@domain.deliver_emails = true
|
||||
@domain.registrant_verification_token = '123'
|
||||
@domain.registrant_verification_asked_at = Time.zone.now
|
||||
@mail = DomainMailer.pending_delete_expired_notification(@domain)
|
||||
end
|
||||
|
||||
it 'should render email subject' do
|
||||
@mail.subject.should =~ /deletion cancelled/
|
||||
end
|
||||
|
||||
it 'should have sender email' do
|
||||
@mail.from.should == ["noreply@internet.ee"]
|
||||
end
|
||||
|
||||
it 'should send confirm email to old registrant email' do
|
||||
@mail.to.should == ["test@example.com"]
|
||||
end
|
||||
|
||||
it 'should render body' do
|
||||
@mail.body.encoded.should =~ /deletion cancelled/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue