BigW Consortium Gitlab

Commit 26482bdd by 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
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
......
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