Read about our upcoming Code of Conduct on this issue

Commit 68734835 authored by Andreas Brandl's avatar Andreas Brandl
Browse files

Don't mess with table aliases.

parent c7f9584dbc28
......@@ -337,14 +337,14 @@ def self.public_or_visible_to_user(user = nil, &block)
authorized = user
.where('project_authorizations.project_id =')
authorized_projects ="#{table_name} AS p1").where('EXISTS (?)', authorized))
.where('project_authorizations.project_id =')
authorized_projects ='EXISTS (?)', authorized))
visible_projects ="#{table_name} AS p2").where('visibility_level IN (?)', levels))
visible_projects ='visibility_level IN (?)', levels))
# We use a UNION here instead of OR clauses since this results in better
# performance.
union =[''),'')])
union =[''),'')])
# TODO: from("(#{union.to_sql}) AS #{table_name}")
where(" IN (#{union.to_sql})") # rubocop:disable GitlabSecurity/SqlInjection
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