mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 06:56:23 +02:00
Merge pull request #2751 from internetee/2742-clienthold-status-must-not-me-reset-unless-the-forcedelete-status-is-reset
fix: prevent client_hold status from returning after manual removal
This commit is contained in:
commit
98bf7fb594
2 changed files with 30 additions and 1 deletions
|
@ -5,16 +5,20 @@ module Domains
|
||||||
class: Domain,
|
class: Domain,
|
||||||
description: 'Domain to set ClientHold on'
|
description: 'Domain to set ClientHold on'
|
||||||
|
|
||||||
|
CLIENT_HOLD_SET_NOTE = "Has been set".freeze
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
# rubocop:disable Metrics/AbcSize
|
||||||
def execute
|
def execute
|
||||||
notify_on_grace_period if should_notify_on_soft_force_delete?
|
notify_on_grace_period if should_notify_on_soft_force_delete?
|
||||||
|
|
||||||
return unless client_holdable?
|
return unless client_holdable?
|
||||||
|
return if domain.force_delete_data['client_hold_mandatory'].to_s.downcase == CLIENT_HOLD_SET_NOTE.downcase
|
||||||
|
|
||||||
domain.statuses << DomainStatus::CLIENT_HOLD
|
domain.statuses << DomainStatus::CLIENT_HOLD
|
||||||
to_stdout("DomainCron.start_client_hold: #{domain.id} (#{domain.name}) #{domain.changes}\n")
|
to_stdout("DomainCron.start_client_hold: #{domain.id} (#{domain.name}) #{domain.changes}\n")
|
||||||
|
domain.force_delete_data['client_hold_mandatory'] = CLIENT_HOLD_SET_NOTE
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
|
|
||||||
notify_client_hold
|
notify_client_hold
|
||||||
|
|
||||||
to_stdout("Successfully set client_hold on (#{domain.name})")
|
to_stdout("Successfully set client_hold on (#{domain.name})")
|
||||||
|
|
|
@ -535,6 +535,31 @@ class ForceDeleteTest < ActionMailer::TestCase
|
||||||
assert_enqueued_jobs 6
|
assert_enqueued_jobs 6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_client_hold_does_not_return_after_manual_removal
|
||||||
|
domain = domains(:shop)
|
||||||
|
domain.update(valid_to: Time.zone.parse('2010-10-05'))
|
||||||
|
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
domain.schedule_force_delete(type: :fast_track)
|
||||||
|
|
||||||
|
travel_to Time.zone.parse('2010-07-25')
|
||||||
|
Domains::ClientHold::SetClientHold.run!
|
||||||
|
domain.reload
|
||||||
|
|
||||||
|
assert_includes(domain.statuses, DomainStatus::CLIENT_HOLD)
|
||||||
|
assert_equal(domain.force_delete_data['client_hold_mandatory'], 'Has been set')
|
||||||
|
|
||||||
|
domain.statuses.delete(DomainStatus::CLIENT_HOLD)
|
||||||
|
domain.save!
|
||||||
|
domain.reload
|
||||||
|
|
||||||
|
Domains::ClientHold::SetClientHold.run!
|
||||||
|
domain.reload
|
||||||
|
|
||||||
|
assert_not_includes(domain.statuses, DomainStatus::CLIENT_HOLD)
|
||||||
|
assert_equal(domain.force_delete_data['client_hold_mandatory'], 'Has been set')
|
||||||
|
end
|
||||||
|
|
||||||
def prepare_bounced_email_address(email)
|
def prepare_bounced_email_address(email)
|
||||||
@bounced_mail = BouncedMailAddress.new
|
@bounced_mail = BouncedMailAddress.new
|
||||||
@bounced_mail.email = email
|
@bounced_mail.email = email
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue