Remove clean_pendings_lowlevel method

This commit is contained in:
Maciej Szlosarczyk 2018-06-26 11:37:31 +03:00
parent a8884b0545
commit 8fb3d511c2
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
3 changed files with 7 additions and 32 deletions

View file

@ -23,7 +23,9 @@ class DomainUpdateConfirmJob < Que::Job
registrant: domain.registrant).deliver_now registrant: domain.registrant).deliver_now
domain.poll_message!(:poll_pending_update_rejected_by_registrant) domain.poll_message!(:poll_pending_update_rejected_by_registrant)
domain.clean_pendings_lowlevel
domain.preclean_pendings
domain.clean_pendings!
end end
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction
end end

View file

@ -294,36 +294,6 @@ class Domain < ActiveRecord::Base
save save
end end
# state changes may be done low-level - no validation
# in this metod we still save PaperTrail log.
def clean_pendings_lowlevel
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
statuses.delete(DomainStatus::PENDING_UPDATE)
statuses.delete(DomainStatus::PENDING_DELETE)
status_notes[DomainStatus::PENDING_UPDATE] = ''
status_notes[DomainStatus::PENDING_DELETE] = ''
hash = {
registrant_verification_token: nil,
registrant_verification_asked_at: nil,
pending_json: {},
status_notes: status_notes,
statuses: statuses.presence || [DomainStatus::OK],
# need this column in order to update PaperTrail version properly
updated_at: Time.now.utc
}
# PaperTrail
self.attributes = hash
record_update
clear_version_instance!
reset_transaction_id
update_columns(hash)
end
def pending_update! def pending_update!
return true if pending_update? return true if pending_update?
self.epp_pending_update = true # for epp self.epp_pending_update = true # for epp

View file

@ -21,7 +21,10 @@ class DomainCron
if domain.pending_delete? || domain.pending_delete_confirmation? if domain.pending_delete? || domain.pending_delete_confirmation?
DomainMailer.pending_delete_expired_notification(domain.id, true).deliver DomainMailer.pending_delete_expired_notification(domain.id, true).deliver
end end
domain.clean_pendings_lowlevel
domain.preclean_pendings
domain.clean_pendings!
unless Rails.env.test? unless Rails.env.test?
STDOUT << "#{Time.zone.now.utc} DomainCron.clean_expired_pendings: ##{domain.id} (#{domain.name})\n" STDOUT << "#{Time.zone.now.utc} DomainCron.clean_expired_pendings: ##{domain.id} (#{domain.name})\n"
end end