Story#111503520 - couldn't apply pending update as registrar wasn't valid

This commit is contained in:
Vladimir Krylov 2016-01-12 14:06:32 +02:00
parent 438b22f19d
commit b28748d667
2 changed files with 8 additions and 12 deletions

View file

@ -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

View file

@ -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