mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Story#117124725 - generate emails of apply_pending_update! only when everything is ok
This commit is contained in:
parent
1d5a79f406
commit
a091c62264
8 changed files with 108 additions and 103 deletions
|
@ -525,19 +525,21 @@ class Epp::Domain < Domain
|
|||
preclean_pendings
|
||||
user = ApiUser.find(pending_json['current_user_id'])
|
||||
frame = Nokogiri::XML(pending_json['frame'])
|
||||
old_registrant_id = registrant_id
|
||||
|
||||
self.deliver_emails = true # turn on email delivery
|
||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||
|
||||
send_mail :registrant_updated_notification_for_old_registrant
|
||||
return unless update(frame, user, false)
|
||||
clean_pendings!
|
||||
|
||||
send_mail :registrant_updated_notification_for_new_registrant
|
||||
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
||||
|
||||
save! # for notification if everything fails
|
||||
|
||||
WhoisRecord.find_by(domain_id: id).save # need to reload model
|
||||
DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, should_deliver)
|
||||
DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, should_deliver)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue