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
ec0dfbe7
Commit
ec0dfbe7
authored
Oct 01, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to update issue state on GraphQL
Accept state_event parameter on UpdateIssue mutation
parent
7dc38e15
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
0 deletions
+99
-0
app/graphql/mutations/issues/update.rb
app/graphql/mutations/issues/update.rb
+4
-0
app/graphql/types/issue_state_event_enum.rb
app/graphql/types/issue_state_event_enum.rb
+11
-0
changelogs/unreleased/issue_233479-allow-graphql-to-update-issue-state.yml
...ased/issue_233479-allow-graphql-to-update-issue-state.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+20
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+33
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+9
-0
spec/graphql/mutations/issues/update_spec.rb
spec/graphql/mutations/issues/update_spec.rb
+17
-0
No files found.
app/graphql/mutations/issues/update.rb
View file @
ec0dfbe7
...
...
@@ -46,6 +46,10 @@ module Mutations
required:
false
,
description:
'The ID of the milestone to be assigned, milestone will be removed if set to null.'
argument
:state_event
,
Types
::
IssueStateEventEnum
,
description:
'Close or reopen an issue.'
,
required:
false
def
resolve
(
project_path
:,
iid
:,
**
args
)
issue
=
authorized_find!
(
project_path:
project_path
,
iid:
iid
)
project
=
issue
.
project
...
...
app/graphql/types/issue_state_event_enum.rb
0 → 100644
View file @
ec0dfbe7
# frozen_string_literal: true
module
Types
class
IssueStateEventEnum
<
BaseEnum
graphql_name
'IssueStateEvent'
description
'Values for issue state events'
value
'REOPEN'
,
'Reopens the issue'
,
value:
'reopen'
value
'CLOSE'
,
'Closes the issue'
,
value:
'close'
end
end
changelogs/unreleased/issue_233479-allow-graphql-to-update-issue-state.yml
0 → 100644
View file @
ec0dfbe7
---
title
:
Allow to update issue state on GraphQL
merge_request
:
44061
author
:
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
ec0dfbe7
...
...
@@ -9424,6 +9424,21 @@ enum IssueState {
opened
}
"""
Values for issue state events
"""
enum
IssueStateEvent
{
"""
Closes
the
issue
"""
CLOSE
"""
Reopens
the
issue
"""
REOPEN
}
"""
Represents total number of issues for the represented statuses
"""
...
...
@@ -19007,6 +19022,11 @@ input UpdateIssueInput {
"""
removeLabelIds
:
[
ID
!]
"""
Close
or
reopen
an
issue
.
"""
stateEvent
:
IssueStateEvent
"""
Title
of
the
issue
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
ec0dfbe7
...
...
@@ -25779,6 +25779,29 @@
],
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "IssueStateEvent",
"description": "Values for issue state events",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "REOPEN",
"description": "Reopens the issue",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "CLOSE",
"description": "Closes the issue",
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "IssueStatusCountsType",
...
...
@@ -55386,6 +55409,16 @@
},
"defaultValue": null
},
{
"name": "stateEvent",
"description": "Close or reopen an issue.",
"type": {
"kind": "ENUM",
"name": "IssueStateEvent",
"ofType": null
},
"defaultValue": null
},
{
"name": "healthStatus",
"description": "The desired health status",
doc/api/graphql/reference/index.md
View file @
ec0dfbe7
...
...
@@ -3304,6 +3304,15 @@ State of a GitLab issue.
|
`locked`
| |
|
`opened`
| |
### IssueStateEvent
Values for issue state events.
| Value | Description |
| ----- | ----------- |
|
`CLOSE`
| Closes the issue |
|
`REOPEN`
| Reopens the issue |
### IssueType
Issue type.
...
...
spec/graphql/mutations/issues/update_spec.rb
View file @
ec0dfbe7
...
...
@@ -70,6 +70,23 @@ RSpec.describe Mutations::Issues::Update do
end
end
context
'when changing state'
do
let_it_be_with_refind
(
:issue
)
{
create
(
:issue
,
project:
project
,
state: :opened
)
}
it
'closes issue'
do
mutation_params
[
:state_event
]
=
'close'
expect
{
subject
}.
to
change
{
issue
.
reload
.
state
}.
from
(
'opened'
).
to
(
'closed'
)
end
it
'reopens issue'
do
issue
.
close
mutation_params
[
:state_event
]
=
'reopen'
expect
{
subject
}.
to
change
{
issue
.
reload
.
state
}.
from
(
'closed'
).
to
(
'opened'
)
end
end
context
'when changing labels'
do
let_it_be
(
:label_1
)
{
create
(
:label
,
project:
project
)
}
let_it_be
(
:label_2
)
{
create
(
:label
,
project:
project
)
}
...
...
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