mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
fix poll message spam after validation email
This commit is contained in:
parent
9ba7af504a
commit
e320a7ced1
3 changed files with 29 additions and 16 deletions
|
@ -6,18 +6,26 @@ module Domains
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_without_email
|
def notify_without_email
|
||||||
domain.registrar.notifications.create!(text: I18n.t('force_delete_set_on_domain',
|
template = I18n.t('force_delete_set_on_domain',
|
||||||
domain_name: domain.name,
|
domain_name: domain.name,
|
||||||
outzone_date: domain.outzone_date,
|
outzone_date: domain.outzone_date,
|
||||||
purge_date: domain.purge_date))
|
purge_date: domain.purge_date)
|
||||||
|
|
||||||
|
return if domain.registrar.notifications.last.text.include? template
|
||||||
|
|
||||||
|
domain.registrar.notifications.create!(text: template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_with_email
|
def notify_with_email
|
||||||
domain.registrar.notifications.create!(text: I18n.t('force_delete_auto_email',
|
template = I18n.t('force_delete_auto_email',
|
||||||
domain_name: domain.name,
|
domain_name: domain.name,
|
||||||
outzone_date: domain.outzone_date,
|
outzone_date: domain.outzone_date,
|
||||||
purge_date: domain.purge_date,
|
purge_date: domain.purge_date,
|
||||||
email: email))
|
email: email)
|
||||||
|
|
||||||
|
return if domain.registrar.notifications.last.text.include? template
|
||||||
|
|
||||||
|
domain.registrar.notifications.create!(text: template)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,18 +31,21 @@ module Domains
|
||||||
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)
|
||||||
notify_registrar(domain)
|
|
||||||
else
|
else
|
||||||
process_force_delete(domain)
|
process_force_delete(domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_registrar(domain)
|
def notify_registrar(domain)
|
||||||
domain.registrar.notifications.create!(text: I18n.t('force_delete_auto_email',
|
template = I18n.t('force_delete_auto_email',
|
||||||
domain_name: domain.name,
|
domain_name: domain.name,
|
||||||
outzone_date: domain.outzone_date,
|
outzone_date: domain.outzone_date,
|
||||||
purge_date: domain.purge_date,
|
purge_date: domain.purge_date,
|
||||||
email: domain.status_notes[DomainStatus::FORCE_DELETE]))
|
email: domain.status_notes[DomainStatus::FORCE_DELETE])
|
||||||
|
|
||||||
|
return if domain.registrar.notifications.last.text.include? template
|
||||||
|
|
||||||
|
domain.registrar.notifications.create!(text: template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_force_delete(domain)
|
def process_force_delete(domain)
|
||||||
|
@ -56,6 +59,8 @@ module Domains
|
||||||
def added_additional_email_into_notes(domain)
|
def added_additional_email_into_notes(domain)
|
||||||
return if domain.status_notes[DomainStatus::FORCE_DELETE].include? email
|
return if domain.status_notes[DomainStatus::FORCE_DELETE].include? email
|
||||||
|
|
||||||
|
# notify_registrar(domain)
|
||||||
|
|
||||||
domain.status_notes[DomainStatus::FORCE_DELETE].concat(" #{email}")
|
domain.status_notes[DomainStatus::FORCE_DELETE].concat(" #{email}")
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
end
|
end
|
||||||
|
|
|
@ -437,7 +437,7 @@ class ForceDeleteTest < ActionMailer::TestCase
|
||||||
|
|
||||||
assert_equal domain.status_notes[DomainStatus::FORCE_DELETE], invalid_emails
|
assert_equal domain.status_notes[DomainStatus::FORCE_DELETE], invalid_emails
|
||||||
notification = domain.registrar.notifications.last
|
notification = domain.registrar.notifications.last
|
||||||
assert notification.text.include? asserted_text
|
assert_not notification.text.include? asserted_text
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_invalid_email_from_domain_status_notes
|
def test_remove_invalid_email_from_domain_status_notes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue