Use Query.visible scope.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8086 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1050993348
commit
b9e02477e9
|
@ -129,14 +129,11 @@ module IssuesHelper
|
||||||
|
|
||||||
def sidebar_queries
|
def sidebar_queries
|
||||||
unless @sidebar_queries
|
unless @sidebar_queries
|
||||||
# User can see public queries and his own queries
|
@sidebar_queries = Query.visible.all(
|
||||||
visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
|
:order => "#{Query.table_name}.name ASC",
|
||||||
# Project specific queries and global queries
|
# Project specific queries and global queries
|
||||||
visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
|
:conditions => (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
|
||||||
@sidebar_queries = Query.find(:all,
|
)
|
||||||
:select => 'id, name, is_public',
|
|
||||||
:order => "name ASC",
|
|
||||||
:conditions => visible.conditions)
|
|
||||||
end
|
end
|
||||||
@sidebar_queries
|
@sidebar_queries
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue