From ad06bec6b6b9900aceb101bafe8fd369096d19a1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 28 Sep 2008 07:54:41 +0000 Subject: 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 --- app/models/news.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') 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 -- cgit v1.2.3