summaryrefslogtreecommitdiffstats
path: root/app/models/mailer.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-09-09 11:02:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-09-09 11:02:13 +0000
commit197a14a82e3e82bd0b5a057ffc397c1a81922453 (patch)
tree78b833f7012ff38f8e2fadea101ccd5185780376 /app/models/mailer.rb
parentff86c37ed33029e25f5cfd90fce2e447471847e3 (diff)
downloadredmine-197a14a82e3e82bd0b5a057ffc397c1a81922453.tar.gz
redmine-197a14a82e3e82bd0b5a057ffc397c1a81922453.zip
Fixed that the reminder email excludes issues assigned to groups (#11723).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10335 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mailer.rb')
-rw-r--r--app/models/mailer.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 1f9a04af4..b8b2ac721 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -327,7 +327,7 @@ class Mailer < ActionMailer::Base
# * :days => how many days in the future to remind about (defaults to 7)
# * :tracker => id of tracker for filtering issues (defaults to all trackers)
# * :project => id or identifier of project to process (defaults to all projects)
- # * :users => array of user ids who should be reminded
+ # * :users => array of user/group ids who should be reminded
def self.reminders(options={})
days = options[:days] || 7
project = options[:project] ? Project.find(options[:project]) : nil
@@ -343,6 +343,15 @@ class Mailer < ActionMailer::Base
scope = scope.scoped(:conditions => {:tracker_id => tracker.id}) if tracker
issues_by_assignee = scope.all(:include => [: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|
+ issues_by_assignee[user] ||= []
+ issues_by_assignee[user] += issues_by_assignee[assignee]
+ end
+ end
+ end
+
issues_by_assignee.each do |assignee, issues|
reminder(assignee, issues, days).deliver if assignee.is_a?(User) && assignee.active?
end