diff options
author | Nick Thomas <nick@gitlab.com> | 2019-02-01 22:40:29 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-02-01 22:40:29 +0300 |
commit | dd26a9addc5dd654e3c8eecb58216f1f4449cfc1 (patch) | |
tree | e103b968cf7574e1298df13a2a71444b90a8978a | |
parent | 3a042391ae89b967ce104acf3dbe8191c572ef25 (diff) | |
parent | ee60128cefae3122f21987b72c60a268ddc8f6b9 (diff) |
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
3 files changed, 29 insertions, 0 deletions
diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index 4ab3c13787a..95e66fb3b7c 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -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, diff --git a/changelogs/unreleased/57063-implement-new-arguments-iid-for-issuesresolver-in-graphql.yml b/changelogs/unreleased/57063-implement-new-arguments-iid-for-issuesresolver-in-graphql.yml new file mode 100644 index 00000000000..b05ab07e14c --- /dev/null +++ b/changelogs/unreleased/57063-implement-new-arguments-iid-for-issuesresolver-in-graphql.yml @@ -0,0 +1,5 @@ +--- +title: Add argument iids for issues in GraphQL +merge_request: 24802 +author: +type: added diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index ca90673521c..1a54ab540fc 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -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 }) |