mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 04:58:29 +02:00
Story#107821878 - pending_update_notification gets new registrant_id too
This commit is contained in:
parent
b389f8282f
commit
44ae8fd350
3 changed files with 5 additions and 5 deletions
|
@ -26,8 +26,9 @@ class DomainMailer < ApplicationMailer
|
||||||
name: @domain.name)} [#{@domain.name}]")
|
name: @domain.name)} [#{@domain.name}]")
|
||||||
end
|
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)
|
@domain = Domain.find_by(id: domain_id)
|
||||||
|
@old_registrant = Registrant.find(old_registrant_id)
|
||||||
return unless @domain
|
return unless @domain
|
||||||
return if delivery_off?(@domain, should_deliver)
|
return if delivery_off?(@domain, should_deliver)
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ class DomainMailer < ApplicationMailer
|
||||||
end
|
end
|
||||||
|
|
||||||
@new_registrant = @domain.registrant # NB! new registrant at this point
|
@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)
|
return if whitelist_blocked?(@new_registrant.email)
|
||||||
mail(to: format(@new_registrant.email),
|
mail(to: format(@new_registrant.email),
|
||||||
|
|
|
@ -430,7 +430,7 @@ class Domain < ActiveRecord::Base
|
||||||
new_registrant_name = registrant.name
|
new_registrant_name = registrant.name
|
||||||
|
|
||||||
DomainMailer.pending_update_request_for_old_registrant(id, old_registrant_id, deliver_emails).deliver
|
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
|
reload # revert back to original
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ describe DomainMailer do
|
||||||
@domain.registrant_verification_token = '123'
|
@domain.registrant_verification_token = '123'
|
||||||
@domain.registrant_verification_asked_at = Time.zone.now
|
@domain.registrant_verification_asked_at = Time.zone.now
|
||||||
@domain.registrant = @new_registrant
|
@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
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
@ -100,7 +100,7 @@ describe DomainMailer do
|
||||||
@domain.registrant_verification_token = '123'
|
@domain.registrant_verification_token = '123'
|
||||||
@domain.registrant_verification_asked_at = Time.zone.now
|
@domain.registrant_verification_asked_at = Time.zone.now
|
||||||
@domain.registrant = @new_registrant
|
@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
|
end
|
||||||
|
|
||||||
it 'should render email subject' do
|
it 'should render email subject' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue