From 90c7cf9763bd02bc832dc20be757e9e2c6b9b616 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 27 Jan 2007 23:22:58 +0000 Subject: [PATCH] proper language setting for mail notifications git-svn-id: http://redmine.rubyforge.org/svn/trunk@200 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/account_controller.rb | 3 --- app/models/mailer.rb | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 9cca8d2c..3712ef7e 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 0da6f967..42d20eca 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -18,7 +18,8 @@ class Mailer < ActionMailer::Base helper IssuesHelper - def issue_add(issue) + 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)