Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cee9aab9
Commit
cee9aab9
authored
Apr 14, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow iteration ids to be passes as a Global ID
but still support passing raw ids
parent
c3468692
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
changelogs/unreleased/bw-iteration-globalid.yml
changelogs/unreleased/bw-iteration-globalid.yml
+5
-0
ee/app/graphql/ee/resolvers/issues_resolver.rb
ee/app/graphql/ee/resolvers/issues_resolver.rb
+18
-1
ee/spec/graphql/ee/resolvers/issues_resolver_spec.rb
ee/spec/graphql/ee/resolvers/issues_resolver_spec.rb
+17
-2
No files found.
changelogs/unreleased/bw-iteration-globalid.yml
0 → 100644
View file @
cee9aab9
---
title
:
Allow a Global ID to be used when filtering issue by iterationId in GraphQL
merge_request
:
57620
author
:
type
:
changed
ee/app/graphql/ee/resolvers/issues_resolver.rb
View file @
cee9aab9
...
...
@@ -9,7 +9,7 @@ module EE
prepended
do
argument
:iteration_id
,
[
::
GraphQL
::
ID_TYPE
,
null:
true
],
required:
false
,
description:
'
Iteration
s applied to the issue.'
description:
'
List of iteration Global ID
s applied to the issue.'
argument
:epic_id
,
GraphQL
::
STRING_TYPE
,
required:
false
,
description:
'ID of an epic associated with the issues, "none" and "any" values are supported.'
...
...
@@ -18,8 +18,25 @@ module EE
description:
'Weight applied to the issue, "none" and "any" values are supported.'
end
override
:resolve_with_lookahead
def
resolve_with_lookahead
(
**
args
)
args
[
:iteration_id
]
=
iteration_ids_from_args
(
args
)
if
args
[
:iteration_id
].
present?
super
end
private
# Originally accepted a raw model id. Now accept a gid, but allow a raw id
# for backward compatibility
def
iteration_ids_from_args
(
args
)
args
[
:iteration_id
].
map
do
|
id
|
::
GitlabSchema
.
parse_gid
(
id
,
expected_type:
::
Iteration
).
model_id
rescue
::
Gitlab
::
Graphql
::
Errors
::
ArgumentError
id
end
end
override
:preloads
def
preloads
super
.
merge
(
...
...
ee/spec/graphql/ee/resolvers/issues_resolver_spec.rb
View file @
cee9aab9
...
...
@@ -67,8 +67,23 @@ RSpec.describe Resolvers::IssuesResolver do
end
describe
'filtering by iteration'
do
it
'returns issues with iteration'
do
expect
(
resolve_issues
(
iteration_id:
[
iteration1
.
id
.
to_s
])).
to
contain_exactly
(
issue1
)
let_it_be
(
:iteration1
)
{
create
(
:iteration
,
group:
group
)
}
let_it_be
(
:iteration2
)
{
create
(
:iteration
,
group:
group
)
}
let_it_be
(
:issue_with_iteration1
)
{
create
(
:issue
,
project:
project
,
iteration:
iteration1
)
}
let_it_be
(
:issue_with_iteration2
)
{
create
(
:issue
,
project:
project
,
iteration:
iteration2
)
}
let_it_be
(
:issue_without_iteration
)
{
create
(
:issue
,
project:
project
)
}
it
'returns issues with iteration using raw id'
do
expect
(
resolve_issues
(
iteration_id:
[
iteration1
.
id
])).
to
contain_exactly
(
issue_with_iteration1
)
end
it
'returns issues with iteration using global id'
do
expect
(
resolve_issues
(
iteration_id:
[
iteration1
.
to_global_id
])).
to
contain_exactly
(
issue_with_iteration1
)
end
it
'returns issues with list iterations using global id'
do
expect
(
resolve_issues
(
iteration_id:
[
iteration1
.
to_global_id
,
iteration2
.
to_global_id
]))
.
to
contain_exactly
(
issue_with_iteration1
,
issue_with_iteration2
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment