summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-06-03 03:31:41 -0700
committerStan Hu <stanhu@gmail.com>2018-06-03 04:24:23 -0700
commitbd4bfcc6411e4819c0c67717095bb2e54e7bb6df (patch)
treea803900600a5de61440026c0a72f75fdf61ff7d0 /lib/api
parentfe0ebf76c49e2512b211c5d43152275c536f7e3a (diff)
downloadgitlab-ce-bd4bfcc6411e4819c0c67717095bb2e54e7bb6df.tar.gz
Fix N+1 with source projects in merge requests APIsh-fix-source-project-nplus-one
Now that we are checking `MergeRequest#for_fork?`, we also need the source project preloaded for a merge request.
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/merge_requests.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index b1e510d72de..278d53427f0 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -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'