summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-03-02 16:01:06 +0100
committerAndreas Brandl <abrandl@gitlab.com>2018-03-02 18:23:03 +0100
commit39011be53daee921dac1648044d1e68b9706197c (patch)
tree695cbcfa7346f2d4f8a4c566bd6f0ae31dd4f5c5 /app/finders
parent0a3fc7e3c283c10ef8415a719e83e80f0122af7d (diff)
downloadgitlab-ce-39011be53daee921dac1648044d1e68b9706197c.tar.gz
Extract method User#authorizations_for_projects.42877-fix-visibility-change-performance
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/snippets_finder.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb
index 565955ffc05..d498a2d6d11 100644
--- a/app/finders/snippets_finder.rb
+++ b/app/finders/snippets_finder.rb
@@ -72,11 +72,7 @@ class SnippetsFinder < UnionFinder
# we can shortcut and just return.
return yield(Project.all) if current_user.full_private_access?
- authorized = current_user
- .project_authorizations
- .select(1)
- .where('project_authorizations.project_id = projects.id')
- authorized_projects = yield(Project.where('EXISTS (?)', authorized))
+ authorized_projects = yield(Project.where('EXISTS (?)', current_user.authorizations_for_projects))
levels = Gitlab::VisibilityLevel.levels_for_user(current_user)
visible_projects = yield(Project.where(visibility_level: levels))