Commit ee60128c authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add argument iids to IssuesResolver

parent 04554d69
......@@ -4,6 +4,10 @@ module Resolvers
class IssuesResolver < BaseResolver
extend ActiveSupport::Concern
argument :iids, [GraphQL::ID_TYPE],
required: false,
description: 'The list of IIDs of issues, e.g., [1, 2]'
argument :search, GraphQL::STRING_TYPE,
required: false
argument :sort, Types::Sort,
......
---
title: Add argument iids for issues in GraphQL
merge_request: 24802
author:
type: added
......@@ -32,6 +32,26 @@ describe Resolvers::IssuesResolver do
expect(resolve_issues).to contain_exactly(issue, issue2)
end
it 'finds a specific issue with iids' do
expect(resolve_issues(iids: issue.iid)).to contain_exactly(issue)
end
it 'finds multiple issues with iids' do
expect(resolve_issues(iids: [issue.iid, issue2.iid]))
.to contain_exactly(issue, issue2)
end
it 'finds only the issues within the project we are looking at' do
another_project = create(:project)
iids = [issue, issue2].map(&:iid)
iids.each do |iid|
create(:issue, project: another_project, iid: iid)
end
expect(resolve_issues(iids: iids)).to contain_exactly(issue, issue2)
end
end
def resolve_issues(args = {}, context = { current_user: current_user })
......
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