summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-21 09:37:06 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-21 09:37:06 +0000
commite920414e6cbb3950456892b3ab7c9d9d7b0d056f (patch)
treeb438cf72284f194e4634f07cc5be9192b32905dc /app
parent03755fb38f58c7a2e8f4b2c10847974dab964977 (diff)
parentfed059a12ddde628a7d19d008c199da00990ce19 (diff)
downloadgitlab-ce-e920414e6cbb3950456892b3ab7c9d9d7b0d056f.tar.gz
Merge branch 'gitlab-ee-d39de0ea-backport' into 'master'
Port GitLab EE ProjectsFinder changes These changes were added in GitLab EE commit d39de0ea91b26b8840195e5674b92c353cc16661. The tests were a bit bugged (they used a non existing group, thus not testing a crucial part) which I only noticed when porting CE changes to EE. See merge request !1854
Diffstat (limited to 'app')
-rw-r--r--app/finders/projects_finder.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index dd35c215c50..3b4e0362e04 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -23,17 +23,17 @@ class ProjectsFinder
group = options[:group]
if group
- base, extra = group_projects(current_user, group)
+ segments = group_projects(current_user, group)
else
- base, extra = all_projects(current_user)
+ segments = all_projects(current_user)
end
- if base and extra
- union = Gitlab::SQL::Union.new([base.select(:id), extra.select(:id)])
+ if segments.length > 1
+ union = Gitlab::SQL::Union.new(segments.map { |s| s.select(:id) })
Project.where("projects.id IN (#{union.to_sql})")
else
- base
+ segments.first
end
end