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
073bd93d
Commit
073bd93d
authored
Jul 27, 2020
by
John Hope
Committed by
Bob Van Landuyt
Jul 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add locked as an argument to updateIssue
parent
3089e201
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
5 deletions
+75
-5
app/graphql/mutations/issues/update.rb
app/graphql/mutations/issues/update.rb
+6
-0
changelogs/unreleased/36319-follow-up.yml
changelogs/unreleased/36319-follow-up.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+5
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+10
-0
spec/graphql/mutations/issues/update_spec.rb
spec/graphql/mutations/issues/update_spec.rb
+8
-5
spec/requests/api/graphql/mutations/issues/update_spec.rb
spec/requests/api/graphql/mutations/issues/update_spec.rb
+41
-0
No files found.
app/graphql/mutations/issues/update.rb
View file @
073bd93d
...
...
@@ -25,6 +25,12 @@ module Mutations
required:
false
,
description:
copy_field_description
(
Types
::
IssueType
,
:confidential
)
argument
:locked
,
GraphQL
::
BOOLEAN_TYPE
,
as: :discussion_locked
,
required:
false
,
description:
copy_field_description
(
Types
::
IssueType
,
:discussion_locked
)
def
resolve
(
project_path
:,
iid
:,
**
args
)
issue
=
authorized_find!
(
project_path:
project_path
,
iid:
iid
)
project
=
issue
.
project
...
...
changelogs/unreleased/36319-follow-up.yml
0 → 100644
View file @
073bd93d
---
title
:
Add locked as an argument to updateIssue
merge_request
:
37105
author
:
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
073bd93d
...
...
@@ -14122,6 +14122,11 @@ input UpdateIssueInput {
"""
iid
:
String
!
"""
Indicates
discussion
is
locked
on
the
issue
"""
locked
:
Boolean
"""
The
project
the
issue
to
mutate
is
in
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
073bd93d
...
...
@@ -41716,6 +41716,16 @@
},
"defaultValue": null
},
{
"name": "locked",
"description": "Indicates discussion is locked on the issue",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{
"name": "healthStatus",
"description": "The desired health status",
spec/graphql/mutations/issues/update_spec.rb
View file @
073bd93d
...
...
@@ -3,14 +3,15 @@
require
'spec_helper'
RSpec
.
describe
Mutations
::
Issues
::
Update
do
let
(
:issue
)
{
create
(
:issue
)
}
let
(
:user
)
{
create
(
:user
)
}
let
_it_be
(
:issue
)
{
create
(
:issue
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:expected_attributes
)
do
{
title:
'new title'
,
description:
'new description'
,
confidential:
true
,
due_date:
Date
.
tomorrow
due_date:
Date
.
tomorrow
,
discussion_locked:
true
}
end
let
(
:mutation
)
{
described_class
.
new
(
object:
nil
,
context:
{
current_user:
user
},
field:
nil
)
}
...
...
@@ -28,8 +29,10 @@ RSpec.describe Mutations::Issues::Update do
subject
{
mutation
.
resolve
(
mutation_params
)
}
it
'raises an error if the resource is not accessible to the user'
do
expect
{
subject
}.
to
raise_error
(
Gitlab
::
Graphql
::
Errors
::
ResourceNotAvailable
)
context
'when the user cannot access the issue'
do
it
'raises an error'
do
expect
{
subject
}.
to
raise_error
(
Gitlab
::
Graphql
::
Errors
::
ResourceNotAvailable
)
end
end
context
'when the user can update the issue'
do
...
...
spec/requests/api/graphql/mutations/issues/update_spec.rb
0 → 100644
View file @
073bd93d
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Update of an existing issue'
do
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:input
)
do
{
project_path:
project
.
full_path
,
iid:
issue
.
iid
.
to_s
,
locked:
true
}
end
let
(
:mutation
)
{
graphql_mutation
(
:update_issue
,
input
)
}
let
(
:mutation_response
)
{
graphql_mutation_response
(
:update_issue
)
}
context
'the user is not allowed to update issue'
do
it_behaves_like
'a mutation that returns top-level errors'
,
errors:
[
'The resource that you are attempting to access does not exist or you don\'t have permission to perform this action'
]
end
context
'when user has permissions to update issue'
do
before
do
project
.
add_developer
(
current_user
)
end
it
'updates the issue'
do
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
expect
(
mutation_response
[
'issue'
]).
to
include
(
'discussionLocked'
=>
true
)
end
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