summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-28 07:54:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-28 07:54:41 +0000
commitad06bec6b6b9900aceb101bafe8fd369096d19a1 (patch)
tree58961d61e8bc5c189e9204ff5b16c0bead62f5a1 /app
parent433f2a043e5776f87a35aeea566a34371675bea9 (diff)
downloadredmine-ad06bec6b6b9900aceb101bafe8fd369096d19a1.tar.gz
redmine-ad06bec6b6b9900aceb101bafe8fd369096d19a1.zip
Fixed: Latest news appear on the homepage for projects with the News module disabled (#1941).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1910 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/news.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index 4c4943b78..969b37a0d 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -1,5 +1,5 @@
-# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2008 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -29,7 +29,7 @@ class News < ActiveRecord::Base
acts_as_activity_provider :find_options => {:include => [:project, :author]}
# 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.table_name}.created_on DESC")
+ def self.latest(user = User.current, count = 5)
+ find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
end
end