diff app/models/mailer.rb @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents e248c7af89ec
children a1bdbf8a87d5
line wrap: on
line diff
--- a/app/models/mailer.rb	Tue Sep 09 09:28:31 2014 +0100
+++ b/app/models/mailer.rb	Tue Sep 09 09:29:00 2014 +0100
@@ -80,7 +80,7 @@
   def self.deliver_issue_edit(journal)
     issue = journal.journalized.reload
     to = journal.notified_users
-    cc = journal.notified_watchers
+    cc = journal.notified_watchers - to
     journal.each_notification(to + cc) do |users|
       issue.each_notification(users) do |users2|
         Mailer.issue_edit(journal, to & users2, cc & users2).deliver
@@ -158,6 +158,7 @@
     @news = news
     @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
     mail :to => news.recipients,
+      :cc => news.cc_for_added_news,
       :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}"
   end
 
@@ -266,7 +267,7 @@
   #   Mailer.account_activation_request(user).deliver => sends an email to all active administrators
   def account_activation_request(user)
     # Send the email to all active administrators
-    recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact
+    recipients = User.active.where(:admin => true).collect { |u| u.mail }.compact
     @user = user
     @url = url_for(:controller => 'users', :action => 'index',
                          :status => User::STATUS_REGISTERED,
@@ -330,8 +331,8 @@
     scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
     scope = scope.where(:project_id => project.id) if project
     scope = scope.where(:tracker_id => tracker.id) if tracker
-
-    issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker).all.group_by(&:assigned_to)
+    issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker).
+                              group_by(&:assigned_to)
     issues_by_assignee.keys.each do |assignee|
       if assignee.is_a?(Group)
         assignee.users.each do |user|
@@ -463,7 +464,7 @@
     if rand
       hash << Redmine::Utils.random_hex(8)
     end
-    host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
+    host = Setting.mail_from.to_s.strip.gsub(%r{^.*@|>}, '')
     host = "#{::Socket.gethostname}.redmine" if host.empty?
     "#{hash.join('.')}@#{host}"
   end