mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Merge branch '107821878-emails' into staging
This commit is contained in:
commit
2102d3f189
7 changed files with 19 additions and 18 deletions
|
@ -1,8 +1,10 @@
|
|||
class ContactMailer < ApplicationMailer
|
||||
include Que::Mailer
|
||||
|
||||
def email_updated(email, contact_id, should_deliver)
|
||||
@contact = Contact.find_by(id: contact_id)
|
||||
def email_updated(old_email, email, contact_id, should_deliver)
|
||||
@contact = Contact.find_by(id: contact_id)
|
||||
@old_email = old_email
|
||||
|
||||
return unless email || @contact
|
||||
return if delivery_off?(@contact, should_deliver)
|
||||
return if whitelist_blocked?(email)
|
||||
|
|
|
@ -26,8 +26,9 @@ class DomainMailer < ApplicationMailer
|
|||
name: @domain.name)} [#{@domain.name}]")
|
||||
end
|
||||
|
||||
def pending_update_notification_for_new_registrant(domain_id, should_deliver)
|
||||
def pending_update_notification_for_new_registrant(domain_id, old_registrant_id, should_deliver)
|
||||
@domain = Domain.find_by(id: domain_id)
|
||||
@old_registrant = Registrant.find(old_registrant_id)
|
||||
return unless @domain
|
||||
return if delivery_off?(@domain, should_deliver)
|
||||
|
||||
|
@ -42,7 +43,6 @@ class DomainMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
@new_registrant = @domain.registrant # NB! new registrant at this point
|
||||
@old_registrant = Registrant.find(@domain.registrant_id_was)
|
||||
|
||||
return if whitelist_blocked?(@new_registrant.email)
|
||||
mail(to: format(@new_registrant.email),
|
||||
|
@ -106,8 +106,9 @@ class DomainMailer < ApplicationMailer
|
|||
name: @domain.name)} [#{@domain.name}]")
|
||||
end
|
||||
|
||||
def pending_deleted(domain_id, should_deliver)
|
||||
def pending_deleted(domain_id, old_registrant_id, should_deliver)
|
||||
@domain = Domain.find_by(id: domain_id)
|
||||
@old_registrant = Registrant.find(old_registrant_id)
|
||||
return unless @domain
|
||||
return if delivery_off?(@domain, should_deliver)
|
||||
|
||||
|
@ -121,8 +122,6 @@ class DomainMailer < ApplicationMailer
|
|||
return
|
||||
end
|
||||
|
||||
@old_registrant = Registrant.find(@domain.registrant_id_was)
|
||||
|
||||
confirm_path = "#{ENV['registrant_url']}/registrant/domain_delete_confirms"
|
||||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class Contact < ActiveRecord::Base
|
|||
emails << domains.map(&:registrant_email) if domains.present?
|
||||
emails = emails.flatten.uniq
|
||||
emails.each do |e|
|
||||
ContactMailer.email_updated(e, id, deliver_emails).deliver
|
||||
ContactMailer.email_updated(email_was, e, id, deliver_emails).deliver
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ class Domain < ActiveRecord::Base
|
|||
new_registrant_name = registrant.name
|
||||
|
||||
DomainMailer.pending_update_request_for_old_registrant(id, old_registrant_id, deliver_emails).deliver
|
||||
DomainMailer.pending_update_notification_for_new_registrant(id, deliver_emails).deliver
|
||||
DomainMailer.pending_update_notification_for_new_registrant(id, old_registrant_id, deliver_emails).deliver
|
||||
|
||||
reload # revert back to original
|
||||
|
||||
|
@ -511,7 +511,7 @@ class Domain < ActiveRecord::Base
|
|||
pending_delete_confirmation!
|
||||
save(validate: false) # should check if this did succeed
|
||||
|
||||
DomainMailer.pending_deleted(id, deliver_emails).deliver
|
||||
DomainMailer.pending_deleted(id, registrant_id_was, deliver_emails).deliver
|
||||
end
|
||||
|
||||
def cancel_pending_delete
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Tere <%= @contact.name %>
|
||||
<br><br>
|
||||
Kontakti <%= @contact.name %> eposti aadress on muudetud<br>
|
||||
endine aadress: <%= @contact.email_was %><br>
|
||||
endine aadress: <%= @old_email %><br>
|
||||
uus aadress: <%= @contact.email %>
|
||||
<br><br>
|
||||
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
||||
|
@ -30,7 +30,7 @@ Eesti Interneti SA
|
|||
Hi <%= @contact.name %>
|
||||
<br><br>
|
||||
E-mail address of <%= @contact.name %> has been changed<br>
|
||||
previous address: <%= @contact.email_was %><br>
|
||||
previous address: <%= @old_email %><br>
|
||||
new address: <%= @contact.email %>
|
||||
<br><br>
|
||||
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Tere <%= @contact.name %>
|
||||
|
||||
Kontakti <%= @contact.name %> eposti aadress on muudetud
|
||||
endine aadress: <%= @contact.email_was %>
|
||||
endine aadress: <%= @old_email %>
|
||||
uus aadress: <%= @contact.email %>
|
||||
|
||||
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
||||
|
@ -30,7 +30,7 @@ Eesti Interneti SA
|
|||
Hi <%= @contact.name %>
|
||||
|
||||
E-mail address of <%= @contact.name %> has been changed
|
||||
previous address: <%= @contact.email_was %>
|
||||
previous address: <%= @old_email %>
|
||||
new address: <%= @contact.email %>
|
||||
|
||||
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
|
||||
|
|
|
@ -71,7 +71,7 @@ describe DomainMailer do
|
|||
@domain.registrant_verification_token = '123'
|
||||
@domain.registrant_verification_asked_at = Time.zone.now
|
||||
@domain.registrant = @new_registrant
|
||||
@mail = DomainMailer.pending_update_notification_for_new_registrant(@domain.id, deliver_emails)
|
||||
@mail = DomainMailer.pending_update_notification_for_new_registrant(@domain.id, @registrant.id, deliver_emails)
|
||||
end
|
||||
|
||||
it 'should render email subject' do
|
||||
|
@ -100,7 +100,7 @@ describe DomainMailer do
|
|||
@domain.registrant_verification_token = '123'
|
||||
@domain.registrant_verification_asked_at = Time.zone.now
|
||||
@domain.registrant = @new_registrant
|
||||
@mail = DomainMailer.pending_update_notification_for_new_registrant(@domain.id, deliver_emails)
|
||||
@mail = DomainMailer.pending_update_notification_for_new_registrant(@domain.id, @registrant.id, deliver_emails)
|
||||
end
|
||||
|
||||
it 'should render email subject' do
|
||||
|
@ -202,7 +202,7 @@ describe DomainMailer do
|
|||
before :all do
|
||||
@registrant = Fabricate(:registrant, email: 'test@example.com')
|
||||
@domain = Fabricate(:domain, registrant: @registrant)
|
||||
@mail = DomainMailer.pending_deleted(@domain.id, deliver_emails)
|
||||
@mail = DomainMailer.pending_deleted(@domain.id, @registrant.id, deliver_emails)
|
||||
end
|
||||
|
||||
it 'should not render email subject' do
|
||||
|
@ -229,7 +229,7 @@ describe DomainMailer do
|
|||
@domain.deliver_emails = true
|
||||
@domain.registrant_verification_token = '123'
|
||||
@domain.registrant_verification_asked_at = Time.zone.now
|
||||
@mail = DomainMailer.pending_deleted(@domain.id, deliver_emails)
|
||||
@mail = DomainMailer.pending_deleted(@domain.id, @registrant.id, deliver_emails)
|
||||
end
|
||||
|
||||
it 'should render email subject' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue