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
Tatuya Kamada
gitlab-ce
Commits
c4be3460
Commit
c4be3460
authored
Mar 27, 2017
by
Alexander Randa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix API group/issues default state filter
parent
f74e9245
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
16 deletions
+36
-16
changelogs/unreleased/23655-api-group-issues.yml
changelogs/unreleased/23655-api-group-issues.yml
+4
-0
lib/api/issues.rb
lib/api/issues.rb
+2
-2
lib/api/v3/issues.rb
lib/api/v3/issues.rb
+2
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+14
-6
spec/requests/api/v3/issues_spec.rb
spec/requests/api/v3/issues_spec.rb
+14
-6
No files found.
changelogs/unreleased/23655-api-group-issues.yml
0 → 100644
View file @
c4be3460
---
title
:
Fix API group/issues default state filter
merge_request
:
author
:
Alexander Randa
lib/api/issues.rb
View file @
c4be3460
...
@@ -63,14 +63,14 @@ module API
...
@@ -63,14 +63,14 @@ module API
success
Entities
::
IssueBasic
success
Entities
::
IssueBasic
end
end
params
do
params
do
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'
opened
'
,
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'
all
'
,
desc:
'Return opened, closed, or all issues'
desc:
'Return opened, closed, or all issues'
use
:issues_params
use
:issues_params
end
end
get
":id/issues"
do
get
":id/issues"
do
group
=
find_group!
(
params
[
:id
])
group
=
find_group!
(
params
[
:id
])
issues
=
find_issues
(
group_id:
group
.
id
,
state:
params
[
:state
]
||
'opened'
)
issues
=
find_issues
(
group_id:
group
.
id
)
present
paginate
(
issues
),
with:
Entities
::
IssueBasic
,
current_user:
current_user
present
paginate
(
issues
),
with:
Entities
::
IssueBasic
,
current_user:
current_user
end
end
...
...
lib/api/v3/issues.rb
View file @
c4be3460
...
@@ -73,14 +73,14 @@ module API
...
@@ -73,14 +73,14 @@ module API
success
::
API
::
Entities
::
Issue
success
::
API
::
Entities
::
Issue
end
end
params
do
params
do
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'
opened
'
,
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'
all
'
,
desc:
'Return opened, closed, or all issues'
desc:
'Return opened, closed, or all issues'
use
:issues_params
use
:issues_params
end
end
get
":id/issues"
do
get
":id/issues"
do
group
=
find_group!
(
params
[
:id
])
group
=
find_group!
(
params
[
:id
])
issues
=
find_issues
(
group_id:
group
.
id
,
state:
params
[
:state
]
||
'opened'
,
match_all_labels:
true
)
issues
=
find_issues
(
group_id:
group
.
id
,
match_all_labels:
true
)
present
paginate
(
issues
),
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
present
paginate
(
issues
),
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
end
end
...
...
spec/requests/api/issues_spec.rb
View file @
c4be3460
...
@@ -333,8 +333,16 @@ describe API::Issues, api: true do
...
@@ -333,8 +333,16 @@ describe API::Issues, api: true do
end
end
let
(
:base_url
)
{
"/groups/
#{
group
.
id
}
/issues"
}
let
(
:base_url
)
{
"/groups/
#{
group
.
id
}
/issues"
}
it
'returns all group issues (including opened and closed)'
do
get
api
(
base_url
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
end
it
'returns group issues without confidential issues for non project members'
do
it
'returns group issues without confidential issues for non project members'
do
get
api
(
base_url
,
non_member
)
get
api
(
"
#{
base_url
}
?state=opened"
,
non_member
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -344,7 +352,7 @@ describe API::Issues, api: true do
...
@@ -344,7 +352,7 @@ describe API::Issues, api: true do
end
end
it
'returns group confidential issues for author'
do
it
'returns group confidential issues for author'
do
get
api
(
base_url
,
author
)
get
api
(
"
#{
base_url
}
?state=opened"
,
author
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -353,7 +361,7 @@ describe API::Issues, api: true do
...
@@ -353,7 +361,7 @@ describe API::Issues, api: true do
end
end
it
'returns group confidential issues for assignee'
do
it
'returns group confidential issues for assignee'
do
get
api
(
base_url
,
assignee
)
get
api
(
"
#{
base_url
}
?state=opened"
,
assignee
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -362,7 +370,7 @@ describe API::Issues, api: true do
...
@@ -362,7 +370,7 @@ describe API::Issues, api: true do
end
end
it
'returns group issues with confidential issues for project members'
do
it
'returns group issues with confidential issues for project members'
do
get
api
(
base_url
,
user
)
get
api
(
"
#{
base_url
}
?state=opened"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -371,7 +379,7 @@ describe API::Issues, api: true do
...
@@ -371,7 +379,7 @@ describe API::Issues, api: true do
end
end
it
'returns group confidential issues for admin'
do
it
'returns group confidential issues for admin'
do
get
api
(
base_url
,
admin
)
get
api
(
"
#{
base_url
}
?state=opened"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -460,7 +468,7 @@ describe API::Issues, api: true do
...
@@ -460,7 +468,7 @@ describe API::Issues, api: true do
end
end
it
'returns an array of issues in given milestone'
do
it
'returns an array of issues in given milestone'
do
get
api
(
"
#{
base_url
}
?milestone=
#{
group_milestone
.
title
}
"
,
user
)
get
api
(
"
#{
base_url
}
?
state=opened&
milestone=
#{
group_milestone
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
...
spec/requests/api/v3/issues_spec.rb
View file @
c4be3460
...
@@ -285,8 +285,16 @@ describe API::V3::Issues, api: true do
...
@@ -285,8 +285,16 @@ describe API::V3::Issues, api: true do
end
end
let
(
:base_url
)
{
"/groups/
#{
group
.
id
}
/issues"
}
let
(
:base_url
)
{
"/groups/
#{
group
.
id
}
/issues"
}
it
'returns all group issues (including opened and closed)'
do
get
v3_api
(
base_url
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
end
it
'returns group issues without confidential issues for non project members'
do
it
'returns group issues without confidential issues for non project members'
do
get
v3_api
(
base_url
,
non_member
)
get
v3_api
(
"
#{
base_url
}
?state=opened"
,
non_member
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -295,7 +303,7 @@ describe API::V3::Issues, api: true do
...
@@ -295,7 +303,7 @@ describe API::V3::Issues, api: true do
end
end
it
'returns group confidential issues for author'
do
it
'returns group confidential issues for author'
do
get
v3_api
(
base_url
,
author
)
get
v3_api
(
"
#{
base_url
}
?state=opened"
,
author
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -303,7 +311,7 @@ describe API::V3::Issues, api: true do
...
@@ -303,7 +311,7 @@ describe API::V3::Issues, api: true do
end
end
it
'returns group confidential issues for assignee'
do
it
'returns group confidential issues for assignee'
do
get
v3_api
(
base_url
,
assignee
)
get
v3_api
(
"
#{
base_url
}
?state=opened"
,
assignee
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -311,7 +319,7 @@ describe API::V3::Issues, api: true do
...
@@ -311,7 +319,7 @@ describe API::V3::Issues, api: true do
end
end
it
'returns group issues with confidential issues for project members'
do
it
'returns group issues with confidential issues for project members'
do
get
v3_api
(
base_url
,
user
)
get
v3_api
(
"
#{
base_url
}
?state=opened"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -319,7 +327,7 @@ describe API::V3::Issues, api: true do
...
@@ -319,7 +327,7 @@ describe API::V3::Issues, api: true do
end
end
it
'returns group confidential issues for admin'
do
it
'returns group confidential issues for admin'
do
get
v3_api
(
base_url
,
admin
)
get
v3_api
(
"
#{
base_url
}
?state=opened"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -368,7 +376,7 @@ describe API::V3::Issues, api: true do
...
@@ -368,7 +376,7 @@ describe API::V3::Issues, api: true do
end
end
it
'returns an array of issues in given milestone'
do
it
'returns an array of issues in given milestone'
do
get
v3_api
(
"
#{
base_url
}
?milestone=
#{
group_milestone
.
title
}
"
,
user
)
get
v3_api
(
"
#{
base_url
}
?
state=opened&
milestone=
#{
group_milestone
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
...
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