diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-04 19:20:25 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-04 19:20:25 +0300 |
commit | 0cedd7039a882b67f1a94875f4e99de4c63b173b (patch) | |
tree | 28806e85f72e870b96554ca8dbdea58c67343fd1 /app | |
parent | ec8d39897c76439c71b79738c5a348b36a03753b (diff) | |
download | gitlab-ce-0cedd7039a882b67f1a94875f4e99de4c63b173b.tar.gz |
Prevent a lot of sql queries for ProjectTeam#fetch_members method
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project_team.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/project_team.rb b/app/models/project_team.rb index cc8bb60aac4..afaca374130 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -144,7 +144,10 @@ class ProjectTeam group_members = group_members.send(level) if group end - (project_members + group_members).map(&:user).uniq + user_ids = project_members.pluck(:user_id) + user_ids += group_members.pluck(:user_id) if group + + User.where(id: user_ids) end def group |