mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Refactor emails #2786
This commit is contained in:
parent
1c7febf47a
commit
e876bf59a5
4 changed files with 34 additions and 32 deletions
|
@ -42,7 +42,14 @@ class Contact < ActiveRecord::Base
|
|||
before_update :manage_emails
|
||||
def manage_emails
|
||||
return nil unless email_changed?
|
||||
ContactMailer.email_updated(self).deliver_now
|
||||
return nil unless deliver_emails == true
|
||||
emails = []
|
||||
emails << [email, email_was]
|
||||
emails << domains.map(&:registrant_email) if domains.present?
|
||||
emails = emails.flatten.uniq
|
||||
emails.each do |e|
|
||||
ContactMailer.email_updated(e, contact).deliver_now
|
||||
end
|
||||
end
|
||||
|
||||
before_save :manage_statuses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue