Fixed an error on welcome screen for users with no membership

git-svn-id: http://redmine.rubyforge.org/svn/trunk@569 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-06-23 16:36:01 +00:00
parent 48c2a690c2
commit ec44c94c12
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class Project < ActiveRecord::Base
def self.visible_by(user=nil)
if user && user.admin?
return ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
elsif user && !user.memberships.any?
elsif user && user.memberships.any?
return ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE} AND (#{Project.table_name}.is_public = ? or #{Project.table_name}.id IN (#{user.memberships.collect{|m| m.project_id}.join(',')}))", true]
else
return ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE} AND #{Project.table_name}.is_public = ?", true]