Allow User objects in Bcc, Cc Reply-To, Sencer and To mail fields
This commit is contained in:
parent
04bf994c9a
commit
b5c9634315
2 changed files with 14 additions and 8 deletions
|
@ -18,7 +18,7 @@ class Mailer < ActionMailer::Base
|
||||||
@user = user
|
@user = user
|
||||||
@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,
|
||||||
subject: I18n.t('mailer.reset_password.subject', username: show_user(user))
|
subject: I18n.t('mailer.reset_password.subject', username: show_user(user))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class Mailer < ActionMailer::Base
|
||||||
@invite = invite
|
@invite = invite
|
||||||
@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
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class Mailer < ActionMailer::Base
|
||||||
@user = user
|
@user = user
|
||||||
@task = task
|
@task = task
|
||||||
|
|
||||||
mail :to => user.email,
|
mail to: user,
|
||||||
subject: I18n.t('mailer.upcoming_tasks.subject')
|
subject: I18n.t('mailer.upcoming_tasks.subject')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class Mailer < ActionMailer::Base
|
||||||
@order = group_order.order
|
@order = group_order.order
|
||||||
@group_order = group_order
|
@group_order = group_order
|
||||||
|
|
||||||
mail :to => user.email,
|
mail to: user,
|
||||||
subject: 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
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class Mailer < ActionMailer::Base
|
||||||
@group = user.ordergroup
|
@group = user.ordergroup
|
||||||
@transaction = transaction
|
@transaction = transaction
|
||||||
|
|
||||||
mail :to => user.email,
|
mail to: user,
|
||||||
subject: I18n.t('mailer.negative_balance.subject')
|
subject: I18n.t('mailer.negative_balance.subject')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class Mailer < ActionMailer::Base
|
||||||
@user = user
|
@user = user
|
||||||
@feedback = feedback
|
@feedback = feedback
|
||||||
|
|
||||||
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: I18n.t('mailer.feedback.subject', email: user.email)
|
subject: I18n.t('mailer.feedback.subject', email: user.email)
|
||||||
end
|
end
|
||||||
|
@ -71,12 +71,18 @@ class Mailer < ActionMailer::Base
|
||||||
@task = task
|
@task = task
|
||||||
@user = user
|
@user = user
|
||||||
|
|
||||||
mail :to => user.email,
|
mail to: user,
|
||||||
subject: I18n.t('mailer.not_enough_users_assigned.subject', task: task.name)
|
subject: I18n.t('mailer.not_enough_users_assigned.subject', task: task.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def mail(args)
|
def mail(args)
|
||||||
args[:subject] = "[#{FoodsoftConfig[:name]}] #{args[:subject]}"
|
args[:subject] = "[#{FoodsoftConfig[:name]}] #{args[:subject]}"
|
||||||
|
|
||||||
|
[:bcc, :cc, :reply_to, :sender, :to].each do |k|
|
||||||
|
user = args[k]
|
||||||
|
args[k] = "#{show_user user} <#{user.email}>" if user.is_a? User
|
||||||
|
end
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class MessagesMailer < Mailer
|
||||||
end
|
end
|
||||||
|
|
||||||
mail subject: message.subject,
|
mail subject: message.subject,
|
||||||
to: recipient.email,
|
to: recipient,
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue