summaryrefslogtreecommitdiffstats
path: root/app/models/news.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-26 18:07:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-26 18:07:57 +0000
commit134b66cb290f084a06a8a4ad7a21913cf002ca85 (patch)
treeff531898cc3225f4ce6a2fcd966e77f26cd23d2e /app/models/news.rb
parent9c1077841eb0747b875794eb468a3aa881f97ff5 (diff)
downloadredmine-134b66cb290f084a06a8a4ad7a21913cf002ca85.tar.gz
redmine-134b66cb290f084a06a8a4ad7a21913cf002ca85.zip
Always notify project members about news unless they turned off all notifications (#4700).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11271 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/news.rb')
-rw-r--r--app/models/news.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index 56c166b6d..c8a4112cc 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -49,6 +49,10 @@ class News < ActiveRecord::Base
user.allowed_to?(:comment_news, project)
end
+ def recipients
+ project.users.select {|user| user.notify_about?(self)}.map(&:mail)
+ end
+
# returns latest news for projects visible by user
def self.latest(user = User.current, count = 5)
visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all