Commit 2395cd7e authored by Andreas Brandl's avatar Andreas Brandl
Browse files

Avoid manual SQL for visibility level check.

parent 70abdfd2ccfc
...@@ -342,7 +342,7 @@ def self.public_or_visible_to_user(user = nil, use_conditions_only: true, &block ...@@ -342,7 +342,7 @@ def self.public_or_visible_to_user(user = nil, use_conditions_only: true, &block
authorized_projects = block.call(where('EXISTS (?)', authorized)) authorized_projects = block.call(where('EXISTS (?)', authorized))
levels = Gitlab::VisibilityLevel.levels_for_user(user) levels = Gitlab::VisibilityLevel.levels_for_user(user)
visible_projects = block.call(where('visibility_level IN (?)', levels)) visible_projects = block.call(where(visibility_level: levels))
# We use a UNION here instead of OR clauses since this results in better # We use a UNION here instead of OR clauses since this results in better
# performance. # performance.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment