Override the mail method of Mailer to automatically add the foodcoop name
This commit is contained in:
parent
96a01daa34
commit
04bf994c9a
2 changed files with 13 additions and 8 deletions
|
@ -19,7 +19,7 @@ class Mailer < ActionMailer::Base
|
||||||
@link = new_password_url(id: @user.id, token: @user.reset_password_token)
|
@link = new_password_url(id: @user.id, token: @user.reset_password_token)
|
||||||
|
|
||||||
mail :to => @user.email,
|
mail :to => @user.email,
|
||||||
:subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.reset_password.subject', :username => show_user(@user))
|
subject: I18n.t('mailer.reset_password.subject', username: show_user(user))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sends an invite email.
|
# Sends an invite email.
|
||||||
|
@ -28,7 +28,7 @@ class Mailer < ActionMailer::Base
|
||||||
@link = accept_invitation_url(token: @invite.token)
|
@link = accept_invitation_url(token: @invite.token)
|
||||||
|
|
||||||
mail :to => @invite.email,
|
mail :to => @invite.email,
|
||||||
:subject => I18n.t('mailer.invite.subject')
|
subject: I18n.t('mailer.invite.subject')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Notify user of upcoming task.
|
# Notify user of upcoming task.
|
||||||
|
@ -37,7 +37,7 @@ class Mailer < ActionMailer::Base
|
||||||
@task = task
|
@task = task
|
||||||
|
|
||||||
mail :to => user.email,
|
mail :to => user.email,
|
||||||
:subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.upcoming_tasks.subject')
|
subject: I18n.t('mailer.upcoming_tasks.subject')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sends order result for specific Ordergroup
|
# Sends order result for specific Ordergroup
|
||||||
|
@ -46,7 +46,7 @@ class Mailer < ActionMailer::Base
|
||||||
@group_order = group_order
|
@group_order = group_order
|
||||||
|
|
||||||
mail :to => user.email,
|
mail :to => user.email,
|
||||||
:subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.order_result.subject', :name => group_order.order.name)
|
subject: I18n.t('mailer.order_result.subject', name: group_order.order.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Notify user if account balance is less than zero
|
# Notify user if account balance is less than zero
|
||||||
|
@ -55,7 +55,7 @@ class Mailer < ActionMailer::Base
|
||||||
@transaction = transaction
|
@transaction = transaction
|
||||||
|
|
||||||
mail :to => user.email,
|
mail :to => user.email,
|
||||||
:subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.negative_balance.subject')
|
subject: I18n.t('mailer.negative_balance.subject')
|
||||||
end
|
end
|
||||||
|
|
||||||
def feedback(user, feedback)
|
def feedback(user, feedback)
|
||||||
|
@ -64,7 +64,7 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
mail :to => FoodsoftConfig[:notification]["error_recipients"],
|
mail :to => FoodsoftConfig[:notification]["error_recipients"],
|
||||||
:from => "#{show_user user} <#{user.email}>",
|
:from => "#{show_user user} <#{user.email}>",
|
||||||
:subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.feedback.subject', :email => user.email)
|
subject: I18n.t('mailer.feedback.subject', email: user.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
def not_enough_users_assigned(task, user)
|
def not_enough_users_assigned(task, user)
|
||||||
|
@ -72,7 +72,12 @@ class Mailer < ActionMailer::Base
|
||||||
@user = user
|
@user = user
|
||||||
|
|
||||||
mail :to => user.email,
|
mail :to => user.email,
|
||||||
:subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.not_enough_users_assigned.subject', :task => task.name)
|
subject: I18n.t('mailer.not_enough_users_assigned.subject', task: task.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def mail(args)
|
||||||
|
args[:subject] = "[#{FoodsoftConfig[:name]}] #{args[:subject]}"
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class MessagesMailer < Mailer
|
||||||
reply_to = "#{show_user(message.sender)} <#{message.sender.email}>"
|
reply_to = "#{show_user(message.sender)} <#{message.sender.email}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
mail subject: "[#{FoodsoftConfig[:name]}] " + message.subject,
|
mail subject: message.subject,
|
||||||
to: recipient.email,
|
to: recipient.email,
|
||||||
from: "#{show_user(message.sender)} via #{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig[:email_sender]}>",
|
from: "#{show_user(message.sender)} via #{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig[:email_sender]}>",
|
||||||
reply_to: reply_to
|
reply_to: reply_to
|
||||||
|
|
Loading…
Reference in a new issue