]> source.dussan.org Git - redmine.git/commitdiff
proper language setting for mail notifications
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 27 Jan 2007 23:22:58 +0000 (23:22 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 27 Jan 2007 23:22:58 +0000 (23:22 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@200 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/account_controller.rb
app/models/mailer.rb

index 9cca8d2c7a2cfc8d7ef311727b48ea1c7c705814..3712ef7e1206513200bc9f48ebe8f721c25ea1c8 100644 (file)
@@ -82,8 +82,6 @@ class AccountController < ApplicationController
         # create a new token for password recovery\r
         token = Token.new(:user => user, :action => "recovery")\r
         if token.save\r
-          # send token to user via email\r
-          Mailer.set_language_if_valid(user.language)\r
           Mailer.deliver_lost_password(token)\r
           flash[:notice] = l(:notice_account_lost_email_sent)\r
           redirect_to :action => 'login'\r
@@ -122,7 +120,6 @@ class AccountController < ApplicationController
         @user.custom_values = @custom_values\r
         token = Token.new(:user => @user, :action => "register")\r
         if @user.save and token.save\r
-          Mailer.set_language_if_valid(@user.language)\r
           Mailer.deliver_register(token)\r
           flash[:notice] = l(:notice_account_register_done)\r
           redirect_to :controller => 'welcome' and return\r
index 0da6f967ff45c8467949d8469d09585a3e26218f..42d20ecacacf741c8e62affb945909edf814f925 100644 (file)
@@ -18,7 +18,8 @@
 class Mailer < ActionMailer::Base\r
   helper IssuesHelper
 
-  def issue_add(issue)
+  def issue_add(issue)\r
+    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\r
 \r
   def issue_edit(journal)\r
+    set_language_if_valid(Setting.default_language)\r
     # Sends to all project members\r
     issue = journal.journalized\r
     @recipients     = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact\r
@@ -37,6 +39,7 @@ class Mailer < ActionMailer::Base
   end\r
   \r
   def document_add(document)\r
+    set_language_if_valid(Setting.default_language)\r
     @recipients     = document.project.users.collect { |u| u.mail if u.mail_notification }.compact\r
     @from           = Setting.mail_from\r
     @subject        = "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"\r
@@ -44,6 +47,7 @@ class Mailer < ActionMailer::Base
   end\r
   \r
   def attachments_add(attachments)\r
+    set_language_if_valid(Setting.default_language)\r
     container = attachments.first.container\r
     url = "http://#{Setting.host_name}/"\r
     added_to = ""\r
@@ -67,6 +71,7 @@ class Mailer < ActionMailer::Base
   end\r
   \r
   def lost_password(token)\r
+    set_language_if_valid(token.user.language)\r
     @recipients     = token.user.mail\r
     @from           = Setting.mail_from\r
     @subject        = l(:mail_subject_lost_password)\r
@@ -74,6 +79,7 @@ class Mailer < ActionMailer::Base
   end  
 \r
   def register(token)\r
+    set_language_if_valid(token.user.language)\r
     @recipients     = token.user.mail\r
     @from           = Setting.mail_from\r
     @subject        = l(:mail_subject_register)\r