mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 20:27:30 +02:00
Merge pull request #2284 from internetee/2242-fd-for-hold-domains
Disable force delete for domains with HOLD status by invalid email reason
This commit is contained in:
commit
3067db0f0e
3 changed files with 27 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
3.1.1
|
3.0.3
|
||||||
|
|
|
@ -11,6 +11,8 @@ module Domains
|
||||||
domains = domain_contacts.map(&:domain).flatten +
|
domains = domain_contacts.map(&:domain).flatten +
|
||||||
Domain.where(registrant_id: registrant_ids)
|
Domain.where(registrant_id: registrant_ids)
|
||||||
|
|
||||||
|
return if expired_or_hold_domains_exists?(domains)
|
||||||
|
|
||||||
domains.each do |domain|
|
domains.each do |domain|
|
||||||
next if domain.expired?
|
next if domain.expired?
|
||||||
|
|
||||||
|
@ -20,6 +22,12 @@ module Domains
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def expired_or_hold_domains_exists?(domains)
|
||||||
|
domains.any? do |domain|
|
||||||
|
domain.statuses.include?(DomainStatus::SERVER_HOLD) && email.include?(domain.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def before_execute_force_delete(domain)
|
def before_execute_force_delete(domain)
|
||||||
if domain.force_delete_scheduled? && !domain.status_notes[DomainStatus::FORCE_DELETE].nil?
|
if domain.force_delete_scheduled? && !domain.status_notes[DomainStatus::FORCE_DELETE].nil?
|
||||||
added_additional_email_into_notes(domain)
|
added_additional_email_into_notes(domain)
|
||||||
|
|
18
test/interactions/force_delete_email/base_test.rb
Normal file
18
test/interactions/force_delete_email/base_test.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class BaseTest < ActiveSupport::TestCase
|
||||||
|
def test_hold_domains_force_delete_email
|
||||||
|
domain = domains(:shop)
|
||||||
|
domain.update!(statuses: [DomainStatus::SERVER_HOLD])
|
||||||
|
domain.update!(expire_time: Time.zone.now + 1.year)
|
||||||
|
|
||||||
|
registrant = domain.registrant
|
||||||
|
registrant.update!(email: "#{registrant.email.split('@').first}@#{domain.name}")
|
||||||
|
|
||||||
|
Domains::ForceDeleteEmail::Base.run(email: registrant.email)
|
||||||
|
|
||||||
|
domain.reload
|
||||||
|
|
||||||
|
assert_not domain.force_delete_scheduled?
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue