Merge branch 'projects-finder-ee-compatible' into 'master'
Removed User#project_relations This is to make things more compatible with EE so merging is easier. cc @dzaporozhets See merge request !3192
This commit is contained in:
commit
a3b626bf25
|
@ -53,7 +53,7 @@ class ProjectsFinder
|
||||||
def all_projects(current_user)
|
def all_projects(current_user)
|
||||||
if current_user
|
if current_user
|
||||||
[
|
[
|
||||||
*current_user.project_relations,
|
current_user.authorized_projects,
|
||||||
public_and_internal_projects
|
public_and_internal_projects
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
|
|
|
@ -442,11 +442,6 @@ class User < ActiveRecord::Base
|
||||||
Project.where("projects.id IN (#{projects_union.to_sql})")
|
Project.where("projects.id IN (#{projects_union.to_sql})")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns all the project relations
|
|
||||||
def project_relations
|
|
||||||
[personal_projects, groups_projects, projects]
|
|
||||||
end
|
|
||||||
|
|
||||||
def owned_projects
|
def owned_projects
|
||||||
@owned_projects ||=
|
@owned_projects ||=
|
||||||
Project.where('namespace_id IN (?) OR namespace_id = ?',
|
Project.where('namespace_id IN (?) OR namespace_id = ?',
|
||||||
|
@ -835,7 +830,9 @@ class User < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def projects_union
|
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
|
end
|
||||||
|
|
||||||
def ci_projects_union
|
def ci_projects_union
|
||||||
|
|
Loading…
Reference in New Issue