summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-14 18:19:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-14 18:19:37 +0000
commit9e225cc63ff889d3dc6f2f904d8e0c33850073b6 (patch)
tree2b9735e0ea949eadd8ac346295e553f52a4c424e /app
parent7ee38a95a0052ddc544137f32fcf9114e5ffabb9 (diff)
downloadredmine-9e225cc63ff889d3dc6f2f904d8e0c33850073b6.tar.gz
redmine-9e225cc63ff889d3dc6f2f904d8e0c33850073b6.zip
Fixed: private subprojects are listed on the issues view (#1217).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1432 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/query.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index d9a720812..f25b5c401 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -265,7 +265,7 @@ class Query < ActiveRecord::Base
def statement
# project/subprojects clause
- clause = ''
+ project_clauses = []
if project && !@project.active_children.empty?
ids = [project.id]
if has_filter?("subproject_id")
@@ -277,17 +277,16 @@ class Query < ActiveRecord::Base
# main project only
else
# all subprojects
- ids += project.active_children.collect{|p| p.id}
+ ids += project.child_ids
end
elsif Setting.display_subprojects_issues?
- ids += project.active_children.collect{|p| p.id}
+ ids += project.child_ids
end
- clause << "#{Issue.table_name}.project_id IN (%s)" % ids.join(',')
+ project_clauses << "#{Issue.table_name}.project_id IN (%s)" % ids.join(',')
elsif project
- clause << "#{Issue.table_name}.project_id = %d" % project.id
- else
- clause << Project.visible_by(User.current)
+ project_clauses << "#{Issue.table_name}.project_id = %d" % project.id
end
+ project_clauses << Project.visible_by(User.current)
# filters clauses
filters_clauses = []
@@ -365,8 +364,6 @@ class Query < ActiveRecord::Base
filters_clauses << sql
end if filters and valid?
- clause << ' AND ' unless clause.empty?
- clause << filters_clauses.join(' AND ') unless filters_clauses.empty?
- clause
+ (project_clauses + filters_clauses).join(' AND ')
end
end