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
5ae5eeac
Commit
5ae5eeac
authored
Feb 09, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-add removed weight param on POST /projects/:id/issues
parent
9197028c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
lib/api/v3/issues.rb
lib/api/v3/issues.rb
+4
-1
spec/requests/api/v3/issues_spec.rb
spec/requests/api/v3/issues_spec.rb
+35
-1
No files found.
lib/api/v3/issues.rb
View file @
5ae5eeac
...
...
@@ -45,6 +45,8 @@ module API
optional
:labels
,
type:
String
,
desc:
'Comma-separated list of label names'
optional
:due_date
,
type:
String
,
desc:
'Date time string in the format YEAR-MONTH-DAY'
optional
:confidential
,
type:
Boolean
,
desc:
'Boolean parameter if the issue should be confidential'
# Gitlab-EE specific
optional
:weight
,
type:
Integer
,
values:
0
..
9
,
desc:
'The weight of the issue'
end
end
...
...
@@ -169,7 +171,8 @@ module API
optional
:state_event
,
type:
String
,
values:
%w[reopen close]
,
desc:
'State of the issue'
use
:issue_params
at_least_one_of
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:labels
,
:created_at
,
:due_date
,
:confidential
,
:state_event
:labels
,
:created_at
,
:due_date
,
:confidential
,
:state_event
,
:weight
end
put
':id/issues/:issue_id'
do
issue
=
user_project
.
issues
.
find
(
params
.
delete
(
:issue_id
))
...
...
spec/requests/api/v3/issues_spec.rb
View file @
5ae5eeac
...
...
@@ -634,6 +634,7 @@ describe API::V3::Issues, api: true do
expect
(
json_response
[
'assignee'
]).
to
be_a
Hash
expect
(
json_response
[
'author'
]).
to
be_a
Hash
expect
(
json_response
[
'confidential'
]).
to
be_falsy
expect
(
json_response
[
'weight'
]).
to
be_nil
end
it
"returns a project issue by id"
do
...
...
@@ -717,13 +718,14 @@ describe API::V3::Issues, api: true do
describe
"POST /projects/:id/issues"
do
it
'creates a new project issue'
do
post
v3_api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
title:
'new issue'
,
labels:
'label, label2'
title:
'new issue'
,
labels:
'label, label2'
,
weight:
3
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'description'
]).
to
be_nil
expect
(
json_response
[
'labels'
]).
to
eq
([
'label'
,
'label2'
])
expect
(
json_response
[
'confidential'
]).
to
be_falsy
expect
(
json_response
[
'weight'
]).
to
eq
(
3
)
end
it
'creates a new confidential project issue'
do
...
...
@@ -1093,6 +1095,38 @@ describe API::V3::Issues, api: true do
end
end
describe
'PUT /projects/:id/issues/:issue_id to update weight'
do
it
'updates an issue with no weight'
do
put
v3_api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
weight:
5
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'weight'
]).
to
eq
(
5
)
end
it
'removes a weight from an issue'
do
weighted_issue
=
create
(
:issue
,
project:
project
,
weight:
2
)
put
v3_api
(
"/projects/
#{
project
.
id
}
/issues/
#{
weighted_issue
.
id
}
"
,
user
),
weight:
nil
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'weight'
]).
to
be_nil
end
it
'returns 400 if weight is less than minimum weight'
do
put
v3_api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
weight:
-
1
expect
(
response
).
to
have_http_status
(
400
)
expect
(
json_response
[
'error'
]).
to
eq
(
'weight does not have a valid value'
)
end
it
'returns 400 if weight is more than maximum weight'
do
put
v3_api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
weight:
10
expect
(
response
).
to
have_http_status
(
400
)
expect
(
json_response
[
'error'
]).
to
eq
(
'weight does not have a valid value'
)
end
end
describe
"DELETE /projects/:id/issues/:issue_id"
do
it
"rejects a non member from deleting an issue"
do
delete
v3_api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
non_member
)
...
...
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