diff --git a/app/jobs/domain_update_confirm_job.rb b/app/jobs/domain_update_confirm_job.rb index be0ada219..3da95287d 100644 --- a/app/jobs/domain_update_confirm_job.rb +++ b/app/jobs/domain_update_confirm_job.rb @@ -3,19 +3,16 @@ class DomainUpdateConfirmJob < Que::Job # it's recommended to keep transaction against job table as short as possible. ActiveRecord::Base.transaction do domain = Epp::Domain.find(domain_id) + domain.is_admin = true case action when RegistrantVerification::CONFIRMED domain.poll_message!(:poll_pending_update_confirmed_by_registrant) - domain.apply_pending_update! do |e| - e.instance_variable_set("@changed_attributes", e.changed_attributes.merge("statuses"=>[])) - end + domain.apply_pending_update! domain.clean_pendings! - WhoisRecord.find_by(domain_id: domain.id).save when RegistrantVerification::REJECTED domain.send_mail :pending_update_rejected_notification_for_new_registrant domain.poll_message!(:poll_pending_update_rejected_by_registrant) domain.clean_pendings! - domain.instance_variable_set("@changed_attributes", domain.changed_attributes.merge("statuses"=>[])) domain.save end destroy # it's best to destroy the job in the same transaction diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index d84de4ca6..15e16163a 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -507,18 +507,17 @@ class Epp::Domain < Domain frame = Nokogiri::XML(pending_json['frame']) self.deliver_emails = true # turn on email delivery - send_mail :registrant_updated_notification_for_old_registrant - - statuses.delete(DomainStatus::PENDING_UPDATE) - yield(self) if block_given? # need to skip statuses check here - self.save - + 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 - update_whois_record + WhoisRecord.find_by(domain_id: id).save # need to reload model + + save! # for notification if everything fails true end