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:
Artur Beljajev 2019-04-07 17:02:43 +03:00
parent 6fa1ce9128
commit 5674071838
12 changed files with 122 additions and 125 deletions

View file

@ -145,8 +145,6 @@ class Epp::Contact < Contact
self.legal_document_id = doc.id
end
self.deliver_emails = true # turn on email delivery for epp
ident_frame = frame.css('ident').first
# https://github.com/internetee/registry/issues/576
@ -175,7 +173,17 @@ class Epp::Contact < Contact
self.upid = current_user.registrar.id if current_user.registrar
self.up_date = Time.zone.now
super(at)
self.attributes = at
email_changed = email_changed?
old_email = email_was
updated = save
if updated && email_changed
ContactMailer.email_changed(contact: self, old_email: old_email).deliver_now
end
updated
end
def statuses_attrs(frame, action)