From c55695d328484a27f2a8cd0c40f96208434f5b26 Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Fri, 30 Oct 2015 19:18:59 +0200 Subject: [PATCH] Story #104525314 - remove pendingDeleteConfirmation when expired --- app/models/domain.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 36ad4213c..2a7a1239f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -223,7 +223,7 @@ class Domain < ActiveRecord::Base count = 0 expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at) expired_pending_domains.each do |domain| - unless domain.pending_update? || domain.pending_delete? + unless domain.pending_update? || domain.pending_delete? || pending_delete_confirmation? msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \ "but no pendingDelete/pendingUpdate state present!\n" STDOUT << msg unless Rails.env.test? @@ -233,7 +233,7 @@ class Domain < ActiveRecord::Base if domain.pending_update? DomainMailer.pending_update_expired_notification_for_new_registrant(domain).deliver_now end - if domain.pending_delete? + if domain.pending_delete? || pending_delete_confirmation? DomainMailer.pending_delete_expired_notification(domain).deliver_now end domain.clean_pendings! @@ -399,6 +399,7 @@ class Domain < ActiveRecord::Base def clean_pendings! preclean_pendings self.pending_json = {} + statuses.delete[DomainStatus::PENDING_DELETE_CONFIRMATION] statuses.delete(DomainStatus::PENDING_UPDATE) statuses.delete(DomainStatus::PENDING_DELETE) status_notes[DomainStatus::PENDING_UPDATE] = '' @@ -694,6 +695,10 @@ class Domain < ActiveRecord::Base statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE) end + def pending_delete_confirmation? + statuses.include? DomainStatus::PENDING_DELETE_CONFIRMATION + end + def pending_delete_prohibited? (statuses_was & [ DomainStatus::CLIENT_DELETE_PROHIBITED,