mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
Refactor contact mailer
- Send single email with new email in `to` and old email in `bcc` fields - Remove `Que::Mailer` (#895) - Add preview - DRY templates - Add tests - Extract translations - Remove useless specs
This commit is contained in:
parent
6fa1ce9128
commit
5674071838
12 changed files with 122 additions and 125 deletions
13
test/mailers/previews/contact_mailer_preview.rb
Normal file
13
test/mailers/previews/contact_mailer_preview.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class ContactMailerPreview < ActionMailer::Preview
|
||||
def email_changed
|
||||
# Replace with `Contact.in_use` once https://github.com/internetee/registry/pull/1146 is merged
|
||||
contact = Contact.where('EXISTS(SELECT 1 FROM domains WHERE domains.registrant_id = contacts.id)
|
||||
OR
|
||||
EXISTS(SELECT 1 FROM domain_contacts WHERE domain_contacts.contact_id =
|
||||
contacts.id)')
|
||||
|
||||
contact = contact.where.not(email: nil, country_code: nil, code: nil).first
|
||||
|
||||
ContactMailer.email_changed(contact: contact, old_email: 'old@inbox.test')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue