Merge pull request #1719 from internetee/fix-soft-force-delete-mailing

DomainCron: Don't send force delete mail if template empty
This commit is contained in:
Timo Võhmar 2020-10-20 17:06:55 +03:00 committed by GitHub
commit 41f888a066
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -15,7 +15,7 @@ module Concerns
domain.registrar.notifications.create!(text: I18n.t('grace_period_started_domain',
domain_name: domain.name,
date: domain.force_delete_start))
send_mail(domain)
send_mail(domain) if domain.template_name.present?
domain.update(contact_notification_sent_date: Time.zone.today)
end

View file

@ -39,6 +39,21 @@ class DomainCronTest < ActiveSupport::TestCase
assert_emails 1
end
def does_not_deliver_forced_email_if_template_empty
Setting.redemption_grace_period = 30
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
assert_not @domain.force_delete_scheduled?
travel_to Time.zone.parse('2010-07-05')
@domain.schedule_force_delete(type: :soft)
@domain.reload
@domain.update(template_name: nil)
travel_to Time.zone.parse('2010-08-06')
DomainCron.start_client_hold
assert_emails 0
end
def test_does_not_sets_hold_if_already_set
Setting.redemption_grace_period = 30