Add tech contacts & info & name@name to force delete mailer

See #1477
This commit is contained in:
Alex Sherman 2020-01-20 13:50:38 +05:00
parent f1ceff818e
commit 6f8a8f6435
3 changed files with 12 additions and 3 deletions

View file

@ -44,7 +44,7 @@ class DomainDeleteMailer < ApplicationMailer
subject = default_i18n_subject(domain_name: domain.name)
mail(from: forced_email_from,
to: domain.primary_contact_emails,
to: domain.force_delete_contact_emails,
subject: subject,
template_path: 'mailers/domain_delete_mailer/forced',
template_name: template_name)

View file

@ -587,6 +587,15 @@ class Domain < ApplicationRecord
(admin_contacts.emails + [registrant.email]).uniq
end
def force_delete_contact_emails
(primary_contact_emails + tech_contacts.pluck(:email) +
["info@#{name}", "#{prepared_domain_name}@#{name}"]).uniq
end
def prepared_domain_name
name.split('.')&.first
end
def new_registrant_email
pending_json['new_registrant_email']
end

View file

@ -73,7 +73,7 @@ class DomainDeleteMailerTest < ActionMailer::TestCase
assert_emails 1
assert_equal ['legal@registry.test'], email.from
assert_equal %w[jane@mail.test john@inbox.test], email.to
assert_equal @domain.force_delete_contact_emails, email.to
assert_equal 'Domeen shop.test on kustutusmenetluses' \
' / Domain shop.test is in deletion process' \
' / Домен shop.test в процессе удаления', email.subject