mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Added domain delete rejection notification #2786
This commit is contained in:
parent
8a92591df7
commit
acb9f2ee08
6 changed files with 79 additions and 0 deletions
|
@ -8,6 +8,7 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
domain.apply_pending_delete!
|
domain.apply_pending_delete!
|
||||||
domain.clean_pendings!
|
domain.clean_pendings!
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
|
DomainMailer.pending_delete_rejected_notification(domain).deliver_now
|
||||||
domain.clean_pendings!
|
domain.clean_pendings!
|
||||||
end
|
end
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
|
|
|
@ -123,4 +123,24 @@ class DomainMailer < ApplicationMailer
|
||||||
subject: "#{I18n.t(:domain_pending_deleted_subject,
|
subject: "#{I18n.t(:domain_pending_deleted_subject,
|
||||||
name: @domain.name)} [#{@domain.name}]")
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pending_delete_rejected_notification(domain)
|
||||||
|
@domain = domain
|
||||||
|
# no delivery off control, driggered by que, no epp request
|
||||||
|
|
||||||
|
if @domain.registrant_verification_token.blank?
|
||||||
|
logger.warn "EMAIL NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if @domain.registrant_verification_asked_at.blank?
|
||||||
|
logger.warn "EMAIL NOT DELIVERED: registrant_verification_asked_at is missing for #{@domain.name}"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
return if whitelist_blocked?(@domain.registrant.email)
|
||||||
|
mail(to: @domain.registrant.email,
|
||||||
|
subject: "#{I18n.t(:pending_delete_rejected_notification_subject,
|
||||||
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
Tere,
|
||||||
|
<br><br>
|
||||||
|
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrar_name %> poolt tagasi lükatud.
|
||||||
|
<br><br>
|
||||||
|
Lugupidamisega<br>
|
||||||
|
Eesti Interneti SA
|
||||||
|
<br><br>
|
||||||
|
<hr>
|
||||||
|
<br><br>
|
||||||
|
Hi,
|
||||||
|
<br><br>
|
||||||
|
Domain <%= @domain.name %> deletion rejected.
|
||||||
|
<br><br>
|
||||||
|
Best Regards,<br>
|
||||||
|
Estonian Internet Foundation
|
|
@ -0,0 +1,15 @@
|
||||||
|
Tere,
|
||||||
|
|
||||||
|
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrar_name %> poolt tagasi lükatud.
|
||||||
|
|
||||||
|
Lugupidamisega
|
||||||
|
Eesti Interneti SA
|
||||||
|
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
Domain <%= @domain.name %> deletion rejected.
|
||||||
|
|
||||||
|
Best Regards,
|
||||||
|
Estonian Internet Foundation
|
|
@ -784,6 +784,7 @@ en:
|
||||||
registrant_updated_notification_for_new_registrant_subject: 'Domeeni %{name} registreerija vahetus teostatud / Registrant change of %{name} has been finished.'
|
registrant_updated_notification_for_new_registrant_subject: 'Domeeni %{name} registreerija vahetus teostatud / Registrant change of %{name} has been finished.'
|
||||||
registrant_updated_notification_for_old_registrant_subject: 'Domeeni %{name} registreerija vahetus teostatud / Registrant change of %{name} has been finished.'
|
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}"
|
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"
|
||||||
whois: WHOIS
|
whois: WHOIS
|
||||||
login_failed_check_id_card: 'Log in failed, check ID card'
|
login_failed_check_id_card: 'Log in failed, check ID card'
|
||||||
not_valid_domain_verification_title: Domain verification not available
|
not_valid_domain_verification_title: Domain verification not available
|
||||||
|
|
|
@ -248,4 +248,31 @@ describe DomainMailer do
|
||||||
@mail.body.encoded.should =~ %r{registrant\/domain_delete_con} # somehowe delete_confirms not matching
|
@mail.body.encoded.should =~ %r{registrant\/domain_delete_con} # somehowe delete_confirms not matching
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'email pending delete notification' do
|
||||||
|
before :all do
|
||||||
|
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||||
|
@domain = Fabricate(:domain, name: 'delete-pending-rejected.ee', registrant: @registrant)
|
||||||
|
@domain.deliver_emails = true
|
||||||
|
@domain.registrant_verification_token = '123'
|
||||||
|
@domain.registrant_verification_asked_at = Time.zone.now
|
||||||
|
@mail = DomainMailer.pending_delete_rejected_notification(@domain)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should render email subject' do
|
||||||
|
@mail.subject.should =~ /kustutamise taotlus tagasi lükatud/
|
||||||
|
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 rejected/
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue