proper language setting for mail notifications

git-svn-id: http://redmine.rubyforge.org/svn/trunk@200 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-01-27 23:22:58 +00:00
parent 3dc9ceaadf
commit 90c7cf9763
2 changed files with 7 additions and 4 deletions

View File

@ -82,8 +82,6 @@ class AccountController < ApplicationController
# create a new token for password recovery
token = Token.new(:user => user, :action => "recovery")
if token.save
# send token to user via email
Mailer.set_language_if_valid(user.language)
Mailer.deliver_lost_password(token)
flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to :action => 'login'
@ -122,7 +120,6 @@ class AccountController < ApplicationController
@user.custom_values = @custom_values
token = Token.new(:user => @user, :action => "register")
if @user.save and token.save
Mailer.set_language_if_valid(@user.language)
Mailer.deliver_register(token)
flash[:notice] = l(:notice_account_register_done)
redirect_to :controller => 'welcome' and return

View File

@ -19,6 +19,7 @@ class Mailer < ActionMailer::Base
helper IssuesHelper
def issue_add(issue)
set_language_if_valid(Setting.default_language)
# Sends to all project members
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact
@from = Setting.mail_from
@ -27,6 +28,7 @@ class Mailer < ActionMailer::Base
end
def issue_edit(journal)
set_language_if_valid(Setting.default_language)
# Sends to all project members
issue = journal.journalized
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact
@ -37,6 +39,7 @@ class Mailer < ActionMailer::Base
end
def document_add(document)
set_language_if_valid(Setting.default_language)
@recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact
@from = Setting.mail_from
@subject = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
@ -44,6 +47,7 @@ class Mailer < ActionMailer::Base
end
def attachments_add(attachments)
set_language_if_valid(Setting.default_language)
container = attachments.first.container
url = "http://#{Setting.host_name}/"
added_to = ""
@ -67,6 +71,7 @@ class Mailer < ActionMailer::Base
end
def lost_password(token)
set_language_if_valid(token.user.language)
@recipients = token.user.mail
@from = Setting.mail_from
@subject = l(:mail_subject_lost_password)
@ -74,6 +79,7 @@ class Mailer < ActionMailer::Base
end
def register(token)
set_language_if_valid(token.user.language)
@recipients = token.user.mail
@from = Setting.mail_from
@subject = l(:mail_subject_register)