Skip to content
Snippets Groups Projects
Commit 3b76b73a authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Removed User#project_relations

GitLab EE adds an extra relation that selects a "project_id" column
instead of an "id" column, making it very hard for this method to be
re-used in EE. Since using User#authorized_groups in
ProjectsFinder#all_groups apparently has no performance impact we can
just use it and keep everything compatible with EE.
parent 34e8c562
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -53,7 +53,7 @@ class ProjectsFinder
def all_projects(current_user)
if current_user
[
*current_user.project_relations,
current_user.authorized_projects,
public_and_internal_projects
]
else
Loading
Loading
Loading
Loading
@@ -442,11 +442,6 @@ class User < ActiveRecord::Base
Project.where("projects.id IN (#{projects_union.to_sql})")
end
 
# Returns all the project relations
def project_relations
[personal_projects, groups_projects, projects]
end
def owned_projects
@owned_projects ||=
Project.where('namespace_id IN (?) OR namespace_id = ?',
Loading
Loading
@@ -835,7 +830,9 @@ class User < ActiveRecord::Base
private
 
def projects_union
Gitlab::SQL::Union.new(project_relations.map { |r| r.select(:id) })
Gitlab::SQL::Union.new([personal_projects.select(:id),
groups_projects.select(:id),
projects.select(:id)])
end
 
def ci_projects_union
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment