Merge pull request #1482 from internetee/1477-force-delete-all-contacts-notification

Add tech contacts & info & name@name to force delete mailer
This commit is contained in:
Timo Võhmar 2020-01-20 13:01:04 +02:00 committed by GitHub
commit b3e5e477ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,9 +73,9 @@ 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
end
end
end