summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-03 21:28:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-03 21:28:14 +0000
commitc870a7b9ef35ed457911638b7a98e7681cfe6d3a (patch)
treea69a9318685afe9a3c46e7f0ea20b9356e135df7 /app/models/issue.rb
parent8bc0f7888bdddf452bbaa97c86e22b6ebc0aac58 (diff)
downloadredmine-c870a7b9ef35ed457911638b7a98e7681cfe6d3a.tar.gz
redmine-c870a7b9ef35ed457911638b7a98e7681cfe6d3a.zip
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
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index d279f3c92..1facf2a56 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -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.