##// END OF EJS Templates
Use Query.visible scope....
Jean-Philippe Lang -
r7966:b9e02477e902
parent child
Show More
@@ -129,14 +129,11 module IssuesHelper
129 129
130 130 def sidebar_queries
131 131 unless @sidebar_queries
132 # User can see public queries and his own queries
133 visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
134 # Project specific queries and global queries
135 visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
136 @sidebar_queries = Query.find(:all,
137 :select => 'id, name, is_public',
138 :order => "name ASC",
139 :conditions => visible.conditions)
132 @sidebar_queries = Query.visible.all(
133 :order => "#{Query.table_name}.name ASC",
134 # Project specific queries and global queries
135 :conditions => (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
136 )
140 137 end
141 138 @sidebar_queries
142 139 end
General Comments 0
You need to be logged in to leave comments. Login now