summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-04 23:05:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-04 23:05:11 +0000
commitb9e02477e90245756d6e5ba1b2da5910bc13ccd7 (patch)
tree5774fa1ddcacf33f1c7ec1d84c24cf22ffa46f4c /app/helpers
parent10509933486ab651c4a185efc37a6340d503f47b (diff)
downloadredmine-b9e02477e90245756d6e5ba1b2da5910bc13ccd7.tar.gz
redmine-b9e02477e90245756d6e5ba1b2da5910bc13ccd7.zip
Use Query.visible scope.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8086 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issues_helper.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index d99256f29..169a0de5f 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -129,14 +129,11 @@ module IssuesHelper
def sidebar_queries
unless @sidebar_queries
- # User can see public queries and his own queries
- visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
- # Project specific queries and global queries
- visible << (@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)
+ @sidebar_queries = Query.visible.all(
+ :order => "#{Query.table_name}.name ASC",
+ # Project specific queries and global queries
+ :conditions => (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
+ )
end
@sidebar_queries
end