diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-12 17:44:48 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-12 17:44:48 +0300 |
commit | 3b76b73ab178f0504e2a9be934fb13f239c81857 (patch) | |
tree | 048256514ade7fd80bc05ee7d091aad1e05cc534 /app | |
parent | 34e8c562363a130ca9f2a6be7959efbc54e64663 (diff) |
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.
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/projects_finder.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index 2b8fba77bb1..0e5a8f5ee0f 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index 101303e1f1f..043bc825ade 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 = ?', @@ -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 |