Commit dd26a9ad authored by Nick Thomas's avatar Nick Thomas

Merge branch '57063-implement-new-arguments-iid-for-issuesresolver-in-graphql' into 'master'

Resolve "Implement new arguments `iid` for `IssuesResolver` in GraphQL"

Closes #57063

See merge request gitlab-org/gitlab-ce!24802
parents 3a042391 ee60128c
...@@ -4,6 +4,10 @@ module Resolvers ...@@ -4,6 +4,10 @@ module Resolvers
class IssuesResolver < BaseResolver class IssuesResolver < BaseResolver
extend ActiveSupport::Concern 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, argument :search, GraphQL::STRING_TYPE,
required: false required: false
argument :sort, Types::Sort, 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 ...@@ -32,6 +32,26 @@ describe Resolvers::IssuesResolver do
expect(resolve_issues).to contain_exactly(issue, issue2) expect(resolve_issues).to contain_exactly(issue, issue2)
end 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 end
def resolve_issues(args = {}, context = { current_user: current_user }) 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