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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
3e7818e9
Commit
3e7818e9
authored
Nov 07, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grapify the issues API
parent
ff02c63c
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
179 deletions
+126
-179
lib/api/helpers.rb
lib/api/helpers.rb
+0
-16
lib/api/issues.rb
lib/api/issues.rb
+112
-151
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+14
-12
No files found.
lib/api/helpers.rb
View file @
3e7818e9
...
...
@@ -217,22 +217,6 @@ module API
end
end
def
issuable_order_by
if
params
[
"order_by"
]
==
'updated_at'
'updated_at'
else
'created_at'
end
end
def
issuable_sort
if
params
[
"sort"
]
==
'asc'
:asc
else
:desc
end
end
def
filter_by_iid
(
items
,
iid
)
items
.
where
(
iid:
iid
)
end
...
...
lib/api/issues.rb
View file @
3e7818e9
This diff is collapsed.
Click to expand it.
spec/requests/api/issues_spec.rb
View file @
3e7818e9
...
...
@@ -72,13 +72,6 @@ describe API::Issues, api: true do
expect
(
json_response
.
last
).
to
have_key
(
'web_url'
)
end
it
"adds pagination headers and keep query params"
do
get
api
(
"/issues?state=closed&per_page=3"
,
user
)
expect
(
response
.
headers
[
'Link'
]).
to
eq
(
'<http://www.example.com/api/v3/issues?page=1&per_page=3&private_token=%s&state=closed>; rel="first", <http://www.example.com/api/v3/issues?page=1&per_page=3&private_token=%s&state=closed>; rel="last"'
%
[
user
.
private_token
,
user
.
private_token
]
)
end
it
'returns an array of closed issues'
do
get
api
(
'/issues?state=closed'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
...
...
@@ -649,9 +642,8 @@ describe API::Issues, api: true do
post
api
(
"/projects/
#{
project
.
id
}
/issues"
,
user
),
title:
'new issue'
,
confidential:
'foo'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new issue'
)
expect
(
json_response
[
'confidential'
]).
to
be_falsy
expect
(
response
).
to
have_http_status
(
400
)
expect
(
json_response
[
'error'
]).
to
eq
(
'confidential is invalid'
)
end
it
"sends notifications for subscribers of newly added labels"
do
...
...
@@ -862,8 +854,8 @@ describe API::Issues, api: true do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
confidential_issue
.
id
}
"
,
user
),
confidential:
'foo'
expect
(
response
).
to
have_http_status
(
2
00
)
expect
(
json_response
[
'
confidential'
]).
to
be_truthy
expect
(
response
).
to
have_http_status
(
4
00
)
expect
(
json_response
[
'
error'
]).
to
eq
(
'confidential is invalid'
)
end
end
end
...
...
@@ -985,6 +977,14 @@ describe API::Issues, api: true do
expect
(
json_response
[
'state'
]).
to
eq
'opened'
end
end
context
'when issue does not exist'
do
it
'returns 404 when trying to move an issue'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/123"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
describe
'/projects/:id/issues/:issue_id/move'
do
...
...
@@ -1033,6 +1033,7 @@ describe API::Issues, api: true do
to_project_id:
target_project
.
id
expect
(
response
).
to
have_http_status
(
404
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Issue Not Found'
)
end
end
...
...
@@ -1042,6 +1043,7 @@ describe API::Issues, api: true do
to_project_id:
target_project
.
id
expect
(
response
).
to
have_http_status
(
404
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Project Not Found'
)
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