Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-02-16 18:05:32 +0300
committerAndreas Brandl <abrandl@gitlab.com>2018-02-20 15:08:25 +0300
commit86591b83501060583fa7c8373faa8986ec4f30f3 (patch)
treea419b2add6dd61692788125a4483b604804a7686 /app/finders/snippets_finder.rb
parent336bc95e361ec51b445732129f61f82903a47fdf (diff)
Remove duplication in Project methods.
Diffstat (limited to 'app/finders/snippets_finder.rb')
-rw-r--r--app/finders/snippets_finder.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb
index 7a343faecdd..c4a84d88dbd 100644
--- a/app/finders/snippets_finder.rb
+++ b/app/finders/snippets_finder.rb
@@ -56,7 +56,10 @@ class SnippetsFinder < UnionFinder
end
def feature_available_projects
- projects = Project.public_or_visible_to_user_with_feature_available(current_user, :snippets).select(:id)
+ projects = Project.public_or_visible_to_user(current_user) do |part|
+ part.with_feature_available_for_user(:snippets, current_user)
+ end.select(:id)
+
arel_query = Arel::Nodes::SqlLiteral.new(projects.to_sql)
table[:project_id].in(arel_query)
end