summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-03-22 06:39:58 -0700
committerStan Hu <stanhu@gmail.com>2019-03-27 06:15:33 -0500
commitc408be48ca3d6840076c6f16c7910411cdfca24c (patch)
tree0c4654b1dde29f6f368991695b173a7d95277729 /app/finders
parent0610bb091766d3bb935fc10898dd66bc6f76b1c5 (diff)
downloadgitlab-ce-c408be48ca3d6840076c6f16c7910411cdfca24c.tar.gz
Optimize /api/v4/projects endpoint for visibility level
Previously when a user requested a list of projects, `Project#public_or_visible_to_user` would search all authorized projects and public/internal projects as well. However, when a user requests a specific `visibility_level` (e.g. private), that should reduce the search space, and we shouldn't need to load public/internal projects. Improves https://gitlab.com/gitlab-org/gitlab-ce/issues/59329
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/projects_finder.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index 93d3c991846..0319e95d439 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -81,7 +81,7 @@ class ProjectsFinder < UnionFinder
if private_only?
current_user.authorized_projects
else
- Project.public_or_visible_to_user(current_user)
+ Project.public_or_visible_to_user(current_user, params[:visibility_level])
end
end
end