mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
107821878-que_mailer
This commit is contained in:
parent
2dddace1b8
commit
90ad9ff887
3 changed files with 5 additions and 6 deletions
|
@ -1,8 +1,7 @@
|
||||||
class ContactMailer < ApplicationMailer
|
class ContactMailer < ApplicationMailer
|
||||||
include Que::Mailer
|
include Que::Mailer
|
||||||
|
|
||||||
def email_updated(email_id, contact_id)
|
def email_updated(email, contact_id)
|
||||||
email = Email.find_by(id: email_id)
|
|
||||||
@contact = Contact.find_by(id: contact_id)
|
@contact = Contact.find_by(id: contact_id)
|
||||||
return unless email || @contact
|
return unless email || @contact
|
||||||
return if delivery_off?(contact)
|
return if delivery_off?(contact)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Contact < ActiveRecord::Base
|
||||||
emails << domains.map(&:registrant_email) if domains.present?
|
emails << domains.map(&:registrant_email) if domains.present?
|
||||||
emails = emails.flatten.uniq
|
emails = emails.flatten.uniq
|
||||||
emails.each do |e|
|
emails.each do |e|
|
||||||
ContactMailer.email_updated(e.id, id).deliver
|
ContactMailer.email_updated(e, id).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe ContactMailer do
|
||||||
describe 'email changed notification when delivery turned off' do
|
describe 'email changed notification when delivery turned off' do
|
||||||
before :all do
|
before :all do
|
||||||
@contact = Fabricate(:contact, email: 'test@example.ee')
|
@contact = Fabricate(:contact, email: 'test@example.ee')
|
||||||
@mail = ContactMailer.email_updated('test@example.com', @contact)
|
@mail = ContactMailer.email_updated('test@example.com', @contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not render email subject' do
|
it 'should not render email subject' do
|
||||||
|
@ -34,7 +34,7 @@ describe ContactMailer do
|
||||||
@contact = @domain.registrant
|
@contact = @domain.registrant
|
||||||
@contact.reload # until figured out why registrant_domains not loaded
|
@contact.reload # until figured out why registrant_domains not loaded
|
||||||
@contact.deliver_emails = true
|
@contact.deliver_emails = true
|
||||||
@mail = ContactMailer.email_updated('info@example.org', @contact)
|
@mail = ContactMailer.email_updated('info@example.org', @contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
@ -60,7 +60,7 @@ describe ContactMailer do
|
||||||
@contact = @domain.registrant
|
@contact = @domain.registrant
|
||||||
@contact.reload # until figured out why registrant_domains not loaded
|
@contact.reload # until figured out why registrant_domains not loaded
|
||||||
@contact.deliver_emails = true
|
@contact.deliver_emails = true
|
||||||
@mail = ContactMailer.email_updated('info@ääöü.org', @contact)
|
@mail = ContactMailer.email_updated('info@ääöü.org', @contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue