mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
Contact email change notification update #2558
This commit is contained in:
parent
cd1f04f155
commit
f6b61a7ac5
2 changed files with 13 additions and 4 deletions
|
@ -8,7 +8,14 @@ class ContactMailer < ApplicationMailer
|
||||||
return if contact.deliver_emails != true
|
return if contact.deliver_emails != true
|
||||||
|
|
||||||
@contact = contact
|
@contact = contact
|
||||||
mail(to: [@contact.email, @contact.email_was],
|
|
||||||
subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
|
emails = []
|
||||||
|
emails << [@contact.email, @contact.email_was] if @contact.registrant_domains.present?
|
||||||
|
emails << @contact.domains.map(&:email) if @contact.domains.present?
|
||||||
|
emails = emails.uniq
|
||||||
|
|
||||||
|
emails.each do |email|
|
||||||
|
mail(to: email, subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,8 @@ describe ContactMailer do
|
||||||
|
|
||||||
describe 'email changed notification' do
|
describe 'email changed notification' do
|
||||||
before :all do
|
before :all do
|
||||||
@contact = Fabricate(:contact, email: 'test@example.com')
|
@domain = Fabricate(:domain)
|
||||||
|
@contact = @domain.registrant
|
||||||
@contact.deliver_emails = true
|
@contact.deliver_emails = true
|
||||||
@contact.email = 'test@example.org' # new email
|
@contact.email = 'test@example.org' # new email
|
||||||
@mail = ContactMailer.email_updated(@contact)
|
@mail = ContactMailer.email_updated(@contact)
|
||||||
|
@ -42,7 +43,8 @@ describe ContactMailer do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have both old and new receiver email' do
|
it 'should have both old and new receiver email' do
|
||||||
@mail.to.should == ["test@example.org", "test@example.com"]
|
@mail.to.size.should == 2
|
||||||
|
@mail.to.include? "test@example.org"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render body' do
|
it 'should render body' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue