fix: prevent client_hold status from returning after manual removal

- Add flag in force_delete_data to track manual client_hold removal
- Update ProcessClientHold to respect manual status removal
- Add test to verify client_hold doesn't return after admin removes it

When an admin manually removes the client_hold status from a domain,
it should not be automatically re-added by the ProcessClientHold job.
This change tracks manual removals and prevents the status from being
re-added while maintaining the force delete process.
This commit is contained in:
oleghasjanov 2025-02-10 13:42:19 +02:00
parent c4bbad934e
commit 6194c5c58a
2 changed files with 30 additions and 1 deletions

View file

@ -5,16 +5,20 @@ module Domains
class: Domain,
description: 'Domain to set ClientHold on'
CLIENT_HOLD_SET_NOTE = "Has been set".freeze
# rubocop:disable Metrics/AbcSize
def execute
notify_on_grace_period if should_notify_on_soft_force_delete?
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
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)
notify_client_hold
to_stdout("Successfully set client_hold on (#{domain.name})")