summaryrefslogtreecommitdiffstats
path: root/app/models/news.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-01-01 10:13:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-01-01 10:13:01 +0000
commit7a03cf92ba62a2aa4c299741bcb8401eefda1c9b (patch)
treebd0edcf338b0522e815b009509b675bad287b2f3 /app/models/news.rb
parente6fa690d65253be4c97188d0df7efd16306d5f78 (diff)
downloadredmine-7a03cf92ba62a2aa4c299741bcb8401eefda1c9b.tar.gz
redmine-7a03cf92ba62a2aa4c299741bcb8401eefda1c9b.zip
fixed: non public projects were shown on welcome screen even if current user is not a member
git-svn-id: http://redmine.rubyforge.org/svn/trunk@129 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/news.rb')
-rw-r--r--app/models/news.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index 0083a0eae..89e94f1ce 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -22,8 +22,8 @@ class News < ActiveRecord::Base
validates_presence_of :title, :description
- # returns last created news
- def self.latest
- find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
+ # returns latest news for projects visible by user
+ def self.latest(user=nil, count=5)
+ find(:all, :limit => count, :conditions => Project.visible_by(user), :include => [ :author, :project ], :order => "news.created_on DESC")
end
end