diff --git a/app/jobs/domain_delete_confirm_job.rb b/app/jobs/domain_delete_confirm_job.rb index 7d890ef16..785483cad 100644 --- a/app/jobs/domain_delete_confirm_job.rb +++ b/app/jobs/domain_delete_confirm_job.rb @@ -7,12 +7,10 @@ class DomainDeleteConfirmJob < Que::Job when RegistrantVerification::CONFIRMED domain.poll_message!(:poll_pending_delete_confirmed_by_registrant) domain.apply_pending_delete! - domain.clean_pendings! when RegistrantVerification::REJECTED DomainMailer.pending_delete_rejected_notification(domain).deliver_now - domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION) domain.poll_message!(:poll_pending_delete_rejected_by_registrant) - domain.clean_pendings! + domain.cancel_pending_delete end destroy # it's best to destroy the job in the same transaction end diff --git a/app/models/domain.rb b/app/models/domain.rb index 9845e8ac8..4e1566d60 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -492,6 +492,12 @@ class Domain < ActiveRecord::Base DomainMailer.pending_deleted(self).deliver_now end + def cancel_pending_delete + statuses.delete DomainStatus::PENDING_DELETE_CONFIRMATION + statuses.delete DomainStatus::PENDING_DELETE + delete_at = nil + end + def pricelist(operation, period_i = nil, unit = nil) period_i ||= period unit ||= period_unit diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 2c3c764f2..9e2e7eb02 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -487,9 +487,8 @@ class Epp::Domain < Domain statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION) statuses.delete(DomainStatus::PENDING_DELETE) DomainMailer.delete_confirmation(self).deliver_now - - # TODO: confirm that this actually makes sense - clean_pendings! if valid? && set_pending_delete! + clean_pendings! + set_pending_delete! true end