mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-14 23:47:48 +00:00
Use mail() instead of devise_mail
The EnterpriseMailer used `devise_mail` to send confirmation instructions. That call is more complicated than `mail` and added an unwanted reply-to header.
This commit is contained in:
@@ -11,12 +11,9 @@ class EnterpriseMailer < Spree::BaseMailer
|
||||
def confirmation_instructions(record, token, opts={})
|
||||
@token = token
|
||||
find_enterprise(record)
|
||||
opts = {
|
||||
subject: "Please confirm your email for #{@enterprise.name}",
|
||||
to: ( @enterprise.unconfirmed_email || @enterprise.email ),
|
||||
from: from_address,
|
||||
}
|
||||
devise_mail(record, :confirmation_instructions, opts)
|
||||
mail(subject: "Please confirm your email for #{@enterprise.name}",
|
||||
to: ( @enterprise.unconfirmed_email || @enterprise.email ),
|
||||
from: from_address)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
%h3
|
||||
= t :email_confirmation_greeting, contact: @resource.contact
|
||||
= t :email_confirmation_greeting, contact: @enterprise.contact
|
||||
%p.lead
|
||||
= t :email_confirmation_profile_created, name: @resource.name
|
||||
= t :email_confirmation_profile_created, name: @enterprise.name
|
||||
%p
|
||||
|
||||
%p.callout
|
||||
= t :email_confirmation_click_link
|
||||
%br
|
||||
%strong
|
||||
= link_to t(:email_confirmation_link_label), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
|
||||
= link_to t(:email_confirmation_link_label), confirmation_url(@enterprise, :confirmation_token => @enterprise.confirmation_token)
|
||||
|
||||
%p
|
||||
%p
|
||||
|
||||
@@ -14,6 +14,7 @@ describe EnterpriseMailer do
|
||||
mail = ActionMailer::Base.deliveries.first
|
||||
expect(mail.subject).to eq "Please confirm your email for #{enterprise.name}"
|
||||
expect(mail.to).to include enterprise.email
|
||||
expect(mail.reply_to).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,4 +39,4 @@ describe EnterpriseMailer do
|
||||
mail = ActionMailer::Base.deliveries.first
|
||||
expect(mail.subject).to eq "#{enterprise.name} is now on #{Spree::Config[:site_name]}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user