BigW Consortium Gitlab

Commit bd4bfcc6 by Stan Hu

Fix N+1 with source projects in merge requests API

Now that we are checking `MergeRequest#for_fork?`, we also need the source project preloaded for a merge request.
parent fe0ebf76
---
title: Fix N+1 with source_projects in merge requests API
merge_request:
author:
type: performance
......@@ -38,7 +38,7 @@ module API
merge_requests = MergeRequestsFinder.new(current_user, args).execute
.reorder(args[:order_by] => args[:sort])
merge_requests = paginate(merge_requests)
.preload(:target_project)
.preload(:source_project, :target_project)
return merge_requests if args[:view] == 'simple'
......
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