-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add poll message on start of grace period for soft delete
Add removing forceDelete on registrant change. Restore email template choosing on safe force delete via admin dashboard. See #1428 (comment)
- Loading branch information
Showing
7 changed files
with
80 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module Concerns | ||
module Job | ||
class ForceDelete | ||
extend ActiveSupport::Concern | ||
|
||
def self.start_client_hold | ||
log_prepare_client_hold | ||
|
||
::PaperTrail.whodunnit = "cron - #{__method__}" | ||
|
||
marked = 0 | ||
real = 0 | ||
|
||
Domain.force_delete_scheduled.each do |domain| | ||
real += 1 | ||
proceed_client_gold(domain: domain) | ||
marked += 1 | ||
end | ||
|
||
log_end_end_client_hold(marked: marked, real: real) | ||
marked | ||
end | ||
|
||
def self.proceed_client_gold(domain:) | ||
notify_on_grace_period(domain) if domain.should_notify_on_soft_force_delete? | ||
return unless domain.client_holdable? | ||
|
||
domain.statuses << DomainStatus::CLIENT_HOLD | ||
log_start_client_hold(domain) | ||
|
||
domain.save(validate: false) and | ||
notify_client_hold(domain) | ||
end | ||
|
||
def self.log_prepare_client_hold | ||
return if Rails.env.test? | ||
|
||
STDOUT << "#{Time.zone.now.utc} - Setting client_hold to domains\n" | ||
end | ||
|
||
def self.log_start_client_hold(domain) | ||
return if Rails.env.test? | ||
|
||
STDOUT << "#{Time.zone.now.utc} DomainCron.start_client_hold: ##{domain.id} "\ | ||
"(#{domain.name}) #{domain.changes}\n" | ||
end | ||
|
||
def self.log_end_end_client_hold(marked:, real:) | ||
return if Rails.env.test? | ||
|
||
STDOUT << "#{Time.zone.now.utc} - Successfully set client_hold to #{marked} of #{real} "\ | ||
"domains\n" | ||
end | ||
|
||
def self.notify_client_hold(domain) | ||
domain.registrar.notifications.create!(text: I18n.t('client_hold_set_on_domain', | ||
domain_name: domain.name, | ||
start_date: domain.force_delete_start)) | ||
end | ||
|
||
def self.notify_on_grace_period(domain) | ||
domain.registrar.notifications.create!(text: I18n.t('grace_period_started_domain', | ||
domain_name: domain.name, | ||
start_date: domain.force_delete_start)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters