project.rb-PATCH.txt

Todd McGrath, 2008-02-03 10:48

Download (735 Bytes)

 
1
Index: C:/rubyworkspace/redmine-trunk/app/models/project.rb
2
===================================================================
3
--- C:/rubyworkspace/redmine-trunk/app/models/project.rb	(revision 128)
4
+++ C:/rubyworkspace/redmine-trunk/app/models/project.rb	(working copy)
5
@@ -36,8 +36,8 @@
6
   validates_format_of :name, :with => /^[\w\s\'\-]*$/i
7
 
8
   # returns 5 last created projects
9
-  def self.latest
10
-    find(:all, :limit => 5, :order => "created_on DESC")	
11
+  def self.latest(user)
12
+   find(:all, :limit => 5, :include => :users, :conditions => ["users.id = ? or is_public = ?", user.id, true], :order => "projects.created_on DESC")	
13
   end	
14
 
15
   # Returns an array of all custom fields enabled for project issues