mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Simplify mailers with Rails default "from" setting
This commit is contained in:
@@ -12,7 +12,6 @@ class EnterpriseMailer < Spree::BaseMailer
|
||||
enterprise: @enterprise.name,
|
||||
sitename: Spree::Config[:site_name])
|
||||
mail(to: enterprise.contact.email,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
end
|
||||
end
|
||||
@@ -20,12 +19,10 @@ class EnterpriseMailer < Spree::BaseMailer
|
||||
def manager_invitation(enterprise, user)
|
||||
@enterprise = enterprise
|
||||
@instance = Spree::Config[:site_name]
|
||||
@instance_email = from_address
|
||||
|
||||
I18n.with_locale valid_locale(@enterprise.owner) do
|
||||
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
|
||||
mail(to: user.email,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class PaymentMailer < Spree::BaseMailer
|
||||
subject = I18n.t('spree.payment_mailer.authorize_payment.subject',
|
||||
distributor: @payment.order.distributor.name)
|
||||
I18n.with_locale valid_locale(@payment.order.user) do
|
||||
mail(to: payment.order.email, from: from_address, subject: subject)
|
||||
mail(to: payment.order.email, subject: subject)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,6 @@ class PaymentMailer < Spree::BaseMailer
|
||||
order: @payment.order)
|
||||
I18n.with_locale valid_locale(shop_owner) do
|
||||
mail(to: shop_owner.email,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,6 @@ class ProducerMailer < Spree::BaseMailer
|
||||
|
||||
mail(
|
||||
to: @producer.contact.email,
|
||||
from: from_address,
|
||||
subject: subject,
|
||||
reply_to: @coordinator.contact.email,
|
||||
cc: @coordinator.contact.email
|
||||
|
||||
@@ -7,12 +7,9 @@ module Spree
|
||||
|
||||
helper TermsAndConditionsHelper
|
||||
|
||||
default from: -> { Spree::Config[:mails_from] }
|
||||
layout 'mailer'
|
||||
|
||||
def from_address
|
||||
Spree::Config[:mails_from]
|
||||
end
|
||||
|
||||
def money(amount)
|
||||
Spree::Money.new(amount).to_s
|
||||
end
|
||||
|
||||
@@ -13,7 +13,6 @@ module Spree
|
||||
@order = find_order(order_or_order_id)
|
||||
I18n.with_locale valid_locale(@order.user) do
|
||||
mail(to: @order.email,
|
||||
from: from_address,
|
||||
subject: mail_subject(t('spree.order_mailer.cancel_email.subject'), resend))
|
||||
end
|
||||
end
|
||||
@@ -23,7 +22,6 @@ module Spree
|
||||
I18n.with_locale valid_locale(@order.distributor.owner) do
|
||||
subject = I18n.t('spree.order_mailer.cancel_email_for_shop.subject')
|
||||
mail(to: @order.distributor.contact.email,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
end
|
||||
end
|
||||
@@ -33,7 +31,6 @@ module Spree
|
||||
I18n.with_locale valid_locale(@order.user) do
|
||||
subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend)
|
||||
mail(to: @order.email,
|
||||
from: from_address,
|
||||
subject: subject,
|
||||
reply_to: @order.distributor.contact.email)
|
||||
end
|
||||
@@ -44,7 +41,6 @@ module Spree
|
||||
I18n.with_locale valid_locale(@order.user) do
|
||||
subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend)
|
||||
mail(to: @order.distributor.contact.email,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
end
|
||||
end
|
||||
@@ -56,7 +52,6 @@ module Spree
|
||||
attach_file("invoice-#{@order.number}.pdf", pdf)
|
||||
I18n.with_locale valid_locale(@order.user) do
|
||||
mail(to: @order.email,
|
||||
from: from_address,
|
||||
subject: mail_subject(t(:invoice), false),
|
||||
reply_to: @order.distributor.contact.email)
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ module Spree
|
||||
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
|
||||
@delivery = delivery
|
||||
subject = base_subject
|
||||
mail(to: @shipment.order.email, from: from_address, subject: subject)
|
||||
mail(to: @shipment.order.email, subject: subject)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,7 +5,7 @@ module Spree
|
||||
def test_email(user)
|
||||
recipient = user.respond_to?(:id) ? user : Spree::User.find(user)
|
||||
subject = "#{Spree::Config[:site_name]} #{t('spree.test_mailer.test_email.subject')}"
|
||||
mail(to: recipient.email, from: from_address, subject: subject)
|
||||
mail(to: recipient.email, subject: subject)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ module Spree
|
||||
"#{I18n.t('spree.user_mailer.reset_password_instructions.subject')}"
|
||||
|
||||
I18n.with_locale valid_locale(user) do
|
||||
mail(to: user.email, from: from_address, subject: subject)
|
||||
mail(to: user.email, subject: subject)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ module Spree
|
||||
def signup_confirmation(user)
|
||||
@user = user
|
||||
I18n.with_locale valid_locale(@user) do
|
||||
mail(to: user.email, from: from_address,
|
||||
mail(to: user.email,
|
||||
subject: t(:welcome_to) + ' ' + Spree::Config[:site_name])
|
||||
end
|
||||
end
|
||||
@@ -39,7 +39,6 @@ module Spree
|
||||
I18n.with_locale valid_locale(@user) do
|
||||
subject = t('spree.user_mailer.confirmation_instructions.subject')
|
||||
mail(to: confirmation_email_address,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,6 @@ class SubscriptionMailer < Spree::BaseMailer
|
||||
@shop = Enterprise.find(summary.shop_id)
|
||||
@summary = summary
|
||||
mail(to: @shop.contact.email,
|
||||
from: from_address,
|
||||
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.placement_summary_email.subject')}")
|
||||
end
|
||||
|
||||
@@ -45,7 +44,6 @@ class SubscriptionMailer < Spree::BaseMailer
|
||||
@shop = Enterprise.find(summary.shop_id)
|
||||
@summary = summary
|
||||
mail(to: @shop.contact.email,
|
||||
from: from_address,
|
||||
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.confirmation_summary_email.subject')}")
|
||||
end
|
||||
|
||||
@@ -56,7 +54,6 @@ class SubscriptionMailer < Spree::BaseMailer
|
||||
confirm_email_subject = t('spree.order_mailer.confirm_email.subject')
|
||||
subject = "#{Spree::Config[:site_name]} #{confirm_email_subject} ##{order.number}"
|
||||
mail(to: order.email,
|
||||
from: from_address,
|
||||
subject: subject,
|
||||
reply_to: order.distributor.contact.email)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user