Do not notify users that are no longer allowed to view an issue (#3589, #4263).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3121 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-12-03 21:28:14 +00:00
1 parent 8bc0f7888b
commit c870a7b9ef
4 files changed
+38 -6

No files matched your search

+15 -5
View File
@@ -250,13 +250,23 @@ class Issue < ActiveRecord::Base
blocked? ? statuses.reject {|s| s.is_closed?} : statuses
end
# Returns the mail adresses of users that should be notified for the issue
# Returns the mail adresses of users that should be notified
def recipients
recipients = project.recipients
notified = project.notified_users
# Author and assignee are always notified unless they have been locked
recipients << author.mail if author && author.active?
recipients << assigned_to.mail if assigned_to && assigned_to.active?
recipients.compact.uniq
notified << author if author && author.active?
notified << assigned_to if assigned_to && assigned_to.active?
notified.uniq!
# Remove users that can not view the issue
notified.reject! {|user| !visible?(user)}
notified.collect(&:mail)
end
# Returns the mail adresses of watchers that should be notified
def watcher_recipients
notified = watcher_users
notified.reject! {|user| !user.active? || !visible?(user)}
notified.collect(&:mail)
end
# Returns the total number of hours spent on this issue.