diff options
Diffstat (limited to 'app/graphql/resolvers/merge_requests_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/merge_requests_resolver.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/graphql/resolvers/merge_requests_resolver.rb b/app/graphql/resolvers/merge_requests_resolver.rb index cda27890d6b..25121dce005 100644 --- a/app/graphql/resolvers/merge_requests_resolver.rb +++ b/app/graphql/resolvers/merge_requests_resolver.rb @@ -20,8 +20,17 @@ module Resolvers args[:iids] ||= [args[:iid]].compact - args[:iids].map { |iid| batch_load(iid) } - .select(&:itself) # .compact doesn't work on BatchLoader + if args[:iids].any? + batch_load_merge_requests(args[:iids]) + else + args[:project_id] = project.id + + MergeRequestsFinder.new(context[:current_user], args).execute + end + end + + def batch_load_merge_requests(iids) + iids.map { |iid| batch_load(iid) }.select(&:itself) # .compact doesn't work on BatchLoader end # rubocop: disable CodeReuse/ActiveRecord |