diff app/models/news.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/news.rb	Tue Sep 09 09:28:31 2014 +0100
+++ b/app/models/news.rb	Tue Sep 09 09:29:00 2014 +0100
@@ -51,7 +51,19 @@
   end
 
   def recipients
-    project.users.select {|user| user.notify_about?(self)}.map(&:mail)
+    project.users.select {|user| user.notify_about?(self) && user.allowed_to?(:view_news, project)}.map(&:mail)
+  end
+
+  # Returns the email addresses that should be cc'd when a new news is added
+  def cc_for_added_news
+    cc = []
+    if m = project.enabled_module('news')
+      cc = m.notified_watchers
+      unless project.is_public?
+        cc = cc.select {|user| project.users.include?(user)}
+      end
+    end
+    cc.map(&:mail)
   end
 
   # returns latest news for projects visible by user