]> source.dussan.org Git - redmine.git/commitdiff
Fixed an error on welcome screen for users with no membership
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 Jun 2007 16:36:01 +0000 (16:36 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 Jun 2007 16:36:01 +0000 (16:36 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@569 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb

index d1504ab808ae44b117b374fa04ecba1a8f7fd49f..2cdf14b28fe508f9dc5f62f9526f900311cb65f6 100644 (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]