Merge pull request #1152 from internetee/remove-legacy-test-emails

Remove legacy test emails
This commit is contained in:
Timo Võhmar 2019-04-11 12:07:36 +03:00 committed by GitHub
commit 0a612c244a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 39 deletions

View file

@ -3,19 +3,6 @@ class ApplicationMailer < ActionMailer::Base
default from: 'noreply@internet.ee'
layout 'mailer'
def whitelist_blocked?(emails)
return false if Rails.env.production? || Rails.env.test?
emails = [emails] unless emails.is_a?(Array)
emails = emails.flatten
emails.each do |email|
next if TEST_EMAILS.include?(email)
logger.info "EMAIL SENDING WAS BLOCKED BY WHITELIST: #{email}"
return true
end
false
end
# turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything
def delivery_off?(model, deliver_emails = false)
return false if deliver_emails == true

View file

@ -13,7 +13,6 @@ class ContactMailer < ApplicationMailer
return unless email || @contact
return if delivery_off?(@contact, should_deliver)
return if whitelist_blocked?(email)
begin
mail(to: format(email), subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")

View file

@ -17,7 +17,6 @@ class DomainMailer < ApplicationMailer
return
end
return if whitelist_blocked?(@domain.registrant.email)
mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:pending_delete_rejected_notification_subject,
name: @domain.name)} [#{@domain.name}]")
@ -29,7 +28,6 @@ class DomainMailer < ApplicationMailer
return if delivery_off?(@domain, should_deliver)
# no delivery off control, driggered by cron, no epp request
return if whitelist_blocked?(@domain.registrant.email)
mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:pending_delete_expired_notification_subject,
name: @domain.name)} [#{@domain.name}]")
@ -40,7 +38,6 @@ class DomainMailer < ApplicationMailer
return unless @domain
return if delivery_off?(@domain, should_deliver)
return if whitelist_blocked?(@domain.registrant.email)
mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:delete_confirmation_subject,
name: @domain.name)} [#{@domain.name}]")

View file

@ -5,7 +5,6 @@ class InvoiceMailer < ApplicationMailer
@invoice = Invoice.find_by(id: invoice_id)
billing_email ||= @invoice.billing_email
return unless @invoice
return if whitelist_blocked?(billing_email)
kit = PDFKit.new(html)
pdf = kit.to_pdf

View file

@ -22,13 +22,6 @@ smtp_enable_starttls_auto: 'true' # 'false'
# If your mail server requires authentication, please change.
smtp_authentication: 'plain' # 'plain', 'login', 'cram_md5'
registrant_url: 'https://registrant.example.com' # for valid email body registrant links
# Staging env does not send any emails unless they are whitelisted
whitelist_emails_for_staging: >
test@example.org,
old@example.org,
new@example.org,
old@example.com,
new@example.com
#
# ADMIN server

View file

@ -1,14 +0,0 @@
TEST_EMAILS =
if Rails.env.test?
%w(
test@example.com
test@example.org
old@example.org
new@example.org
old@example.com
new@example.com
)
else
ENV['whitelist_emails_for_staging'] ||= ''
ENV['whitelist_emails_for_staging'].to_s.split(',').map(&:strip)
end