Commit 26482bdd authored by Yorick Peterse's avatar Yorick Peterse

Don't pluck project IDs in User#owned_projects

This won't work efficiently if you happen to have a lot of projects.
parent 73f302ed
...@@ -404,10 +404,8 @@ class User < ActiveRecord::Base ...@@ -404,10 +404,8 @@ class User < ActiveRecord::Base
def owned_projects def owned_projects
@owned_projects ||= @owned_projects ||=
begin Project.where('namespace_id IN (?) OR namespace_id = ?',
namespace_ids = owned_groups.pluck(:id).push(namespace.id) owned_groups.select(:id), namespace.id).joins(:namespace)
Project.in_namespace(namespace_ids).joins(:namespace)
end
end end
# Team membership in authorized projects # Team membership in authorized projects
......
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