Make the check against billing email set from form

This commit is contained in:
Maciej Szlosarczyk 2018-09-20 13:39:35 +03:00
parent 3f1ef213eb
commit 03b3f9a276
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765

View file

@ -4,8 +4,10 @@ class InvoiceMailer < ApplicationMailer
def invoice_email(invoice_id, html, billing_email)
@invoice = Invoice.find_by(id: invoice_id)
billing_email ||= @invoice.billing_email
logger.info "Billing email from form: #{billing_email}"
logger.info "Billing email from invoice database: #{@invoice.billing_email || nil}"
return unless @invoice
return if whitelist_blocked?(@invoice.billing_email)
return if whitelist_blocked?(billing_email)
kit = PDFKit.new(html)
pdf = kit.to_pdf