diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-02-20 19:02:11 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-02-20 19:02:11 +0300 |
commit | 02b9fa0386bb1d96ecd9078da2fb55d8b522f70d (patch) | |
tree | 799bb6056d4f245b64d0771aa4b9d7180efff05a /app | |
parent | 715183da4b44603232733be7ae4f7578d0eb6bde (diff) |
Rename use_conditions_only option to use_where_in.
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/snippets_finder.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb index 581cd5f47a7..ec61fe1892e 100644 --- a/app/finders/snippets_finder.rb +++ b/app/finders/snippets_finder.rb @@ -56,7 +56,7 @@ class SnippetsFinder < UnionFinder end def feature_available_projects - projects = Project.public_or_visible_to_user(current_user, use_conditions_only: false) do |part| + projects = Project.public_or_visible_to_user(current_user, use_where_in: false) do |part| part.with_feature_available_for_user(:snippets, current_user) end.select(:id) diff --git a/app/models/project.rb b/app/models/project.rb index c23501de823..79058d51af8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -322,10 +322,10 @@ class Project < ActiveRecord::Base # This is useful for performance as we can stick those additional filters # at the bottom of e.g. the UNION. # - # Optionally, turning `use_conditions_only` off leads to returning a + # Optionally, turning `use_where_in` off leads to returning a # relation using #from instead of #where. This can perform much better # but leads to trouble when used in conjunction with AR's #merge method. - def self.public_or_visible_to_user(user = nil, use_conditions_only: true, &block) + def self.public_or_visible_to_user(user = nil, use_where_in: true, &block) # If we don't get a block passed, use identity to avoid if/else repetitions block = ->(part) { part } unless block_given? @@ -348,7 +348,7 @@ class Project < ActiveRecord::Base # performance. union = Gitlab::SQL::Union.new([authorized_projects.select('projects.id'), visible_projects.select('projects.id')]) - if use_conditions_only + if use_where_in where("projects.id IN (#{union.to_sql})") # rubocop:disable GitlabSecurity/SqlInjection else from("(#{union.to_sql}) AS #{table_name}") |