diff options
-rw-r--r-- | app/models/user.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 47439ce4b00..9d75bb3aeb4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -404,10 +404,8 @@ class User < ActiveRecord::Base def owned_projects @owned_projects ||= - begin - namespace_ids = owned_groups.pluck(:id).push(namespace.id) - Project.in_namespace(namespace_ids).joins(:namespace) - end + Project.where('namespace_id IN (?) OR namespace_id = ?', + owned_groups.select(:id), namespace.id).joins(:namespace) end # Team membership in authorized projects |