mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 05:05:45 +02:00
Add FD if email belongs to registant
This commit is contained in:
parent
a3260bb5bf
commit
81c21db392
2 changed files with 20 additions and 1 deletions
|
@ -6,7 +6,11 @@ module Domains
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
domain_contacts = Contact.where(email: email).map(&:domain_contacts).flatten
|
domain_contacts = Contact.where(email: email).map(&:domain_contacts).flatten
|
||||||
domains = domain_contacts.map(&:domain).flatten
|
registrant_ids = Registrant.where(email: email).pluck(:id)
|
||||||
|
|
||||||
|
domains = domain_contacts.map(&:domain).flatten +
|
||||||
|
Domain.where(registrant_id: registrant_ids)
|
||||||
|
|
||||||
domains.each do |domain|
|
domains.each do |domain|
|
||||||
next if domain.force_delete_scheduled?
|
next if domain.force_delete_scheduled?
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,21 @@ class ForceDeleteTest < ActionMailer::TestCase
|
||||||
assert_equal Date.parse('2010-08-05'), @domain.force_delete_start.to_date
|
assert_equal Date.parse('2010-08-05'), @domain.force_delete_start.to_date
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_schedules_force_delete_after_registrant_bounce
|
||||||
|
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
||||||
|
assert_not @domain.force_delete_scheduled?
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
|
prepare_bounced_email_address(@domain.registrant.email)
|
||||||
|
|
||||||
|
@domain.reload
|
||||||
|
|
||||||
|
assert @domain.force_delete_scheduled?
|
||||||
|
assert_equal 'invalid_email', @domain.template_name
|
||||||
|
assert_equal Date.parse('2010-09-19'), @domain.force_delete_date.to_date
|
||||||
|
assert_equal Date.parse('2010-08-05'), @domain.force_delete_start.to_date
|
||||||
|
end
|
||||||
|
|
||||||
def test_schedules_force_delete_invalid_contact
|
def test_schedules_force_delete_invalid_contact
|
||||||
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
||||||
assert_not @domain.force_delete_scheduled?
|
assert_not @domain.force_delete_scheduled?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue