Commit 90c7cf97 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

proper language setting for mail notifications

git-svn-id: http://redmine.rubyforge.org/svn/trunk@200 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 3dc9ceaa
...@@ -82,8 +82,6 @@ class AccountController < ApplicationController ...@@ -82,8 +82,6 @@ class AccountController < ApplicationController
# create a new token for password recovery # create a new token for password recovery
token = Token.new(:user => user, :action => "recovery") token = Token.new(:user => user, :action => "recovery")
if token.save if token.save
# send token to user via email
Mailer.set_language_if_valid(user.language)
Mailer.deliver_lost_password(token) Mailer.deliver_lost_password(token)
flash[:notice] = l(:notice_account_lost_email_sent) flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to :action => 'login' redirect_to :action => 'login'
...@@ -122,7 +120,6 @@ class AccountController < ApplicationController ...@@ -122,7 +120,6 @@ class AccountController < ApplicationController
@user.custom_values = @custom_values @user.custom_values = @custom_values
token = Token.new(:user => @user, :action => "register") token = Token.new(:user => @user, :action => "register")
if @user.save and token.save if @user.save and token.save
Mailer.set_language_if_valid(@user.language)
Mailer.deliver_register(token) Mailer.deliver_register(token)
flash[:notice] = l(:notice_account_register_done) flash[:notice] = l(:notice_account_register_done)
redirect_to :controller => 'welcome' and return redirect_to :controller => 'welcome' and return
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
class Mailer < ActionMailer::Base class Mailer < ActionMailer::Base
helper IssuesHelper helper IssuesHelper
def issue_add(issue) def issue_add(issue)
set_language_if_valid(Setting.default_language)
# Sends to all project members # Sends to all project members
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact
@from = Setting.mail_from @from = Setting.mail_from
...@@ -27,6 +28,7 @@ class Mailer < ActionMailer::Base ...@@ -27,6 +28,7 @@ class Mailer < ActionMailer::Base
end end
def issue_edit(journal) def issue_edit(journal)
set_language_if_valid(Setting.default_language)
# Sends to all project members # Sends to all project members
issue = journal.journalized issue = journal.journalized
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact
...@@ -37,6 +39,7 @@ class Mailer < ActionMailer::Base ...@@ -37,6 +39,7 @@ class Mailer < ActionMailer::Base
end end
def document_add(document) def document_add(document)
set_language_if_valid(Setting.default_language)
@recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact @recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact
@from = Setting.mail_from @from = Setting.mail_from
@subject = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}" @subject = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
...@@ -44,6 +47,7 @@ class Mailer < ActionMailer::Base ...@@ -44,6 +47,7 @@ class Mailer < ActionMailer::Base
end end
def attachments_add(attachments) def attachments_add(attachments)
set_language_if_valid(Setting.default_language)
container = attachments.first.container container = attachments.first.container
url = "http://#{Setting.host_name}/" url = "http://#{Setting.host_name}/"
added_to = "" added_to = ""
...@@ -67,6 +71,7 @@ class Mailer < ActionMailer::Base ...@@ -67,6 +71,7 @@ class Mailer < ActionMailer::Base
end end
def lost_password(token) def lost_password(token)
set_language_if_valid(token.user.language)
@recipients = token.user.mail @recipients = token.user.mail
@from = Setting.mail_from @from = Setting.mail_from
@subject = l(:mail_subject_lost_password) @subject = l(:mail_subject_lost_password)
...@@ -74,6 +79,7 @@ class Mailer < ActionMailer::Base ...@@ -74,6 +79,7 @@ class Mailer < ActionMailer::Base
end end
def register(token) def register(token)
set_language_if_valid(token.user.language)
@recipients = token.user.mail @recipients = token.user.mail
@from = Setting.mail_from @from = Setting.mail_from
@subject = l(:mail_subject_register) @subject = l(:mail_subject_register)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment