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
Boxiang Sun
gitlab-ce
Commits
84ac742f
Commit
84ac742f
authored
Nov 14, 2016
by
Francesco Coda Zabetta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix labels API adding missing parameter (current_user)
parent
36fa5d66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
lib/api/entities.rb
lib/api/entities.rb
+12
-1
spec/requests/api/labels_spec.rb
spec/requests/api/labels_spec.rb
+20
-8
No files found.
lib/api/entities.rb
View file @
84ac742f
...
...
@@ -437,7 +437,18 @@ module API
end
class
Label
<
LabelBasic
expose
:open_issues_count
,
:closed_issues_count
,
:open_merge_requests_count
expose
:open_issues_count
do
|
label
,
options
|
label
.
open_issues_count
(
options
[
:current_user
])
end
expose
:closed_issues_count
do
|
label
,
options
|
label
.
closed_issues_count
(
options
[
:current_user
])
end
expose
:open_merge_requests_count
do
|
label
,
options
|
label
.
open_merge_requests_count
(
options
[
:current_user
])
end
expose
:priority
do
|
label
,
options
|
label
.
priority
(
options
[
:project
])
end
...
...
spec/requests/api/labels_spec.rb
View file @
84ac742f
...
...
@@ -17,6 +17,8 @@ describe API::API, api: true do
group
=
create
(
:group
)
group_label
=
create
(
:group_label
,
title:
'feature'
,
group:
group
)
project
.
update
(
group:
group
)
create
(
:labeled_issue
,
project:
project
,
labels:
[
group_label
],
author:
user
)
create
(
:labeled_issue
,
project:
project
,
labels:
[
label1
],
author:
user
,
state: :closed
)
expected_keys
=
[
'id'
,
'name'
,
'color'
,
'description'
,
'open_issues_count'
,
'closed_issues_count'
,
'open_merge_requests_count'
,
...
...
@@ -30,14 +32,24 @@ describe API::API, api: true do
expect
(
json_response
.
size
).
to
eq
(
3
)
expect
(
json_response
.
first
.
keys
).
to
match_array
expected_keys
expect
(
json_response
.
map
{
|
l
|
l
[
'name'
]
}).
to
match_array
([
group_label
.
name
,
priority_label
.
name
,
label1
.
name
])
expect
(
json_response
.
last
[
'name'
]).
to
eq
(
label1
.
name
)
expect
(
json_response
.
last
[
'color'
]).
to
be_present
expect
(
json_response
.
last
[
'description'
]).
to
be_nil
expect
(
json_response
.
last
[
'open_issues_count'
]).
to
eq
(
0
)
expect
(
json_response
.
last
[
'closed_issues_count'
]).
to
eq
(
0
)
expect
(
json_response
.
last
[
'open_merge_requests_count'
]).
to
eq
(
0
)
expect
(
json_response
.
last
[
'priority'
]).
to
be_nil
expect
(
json_response
.
last
[
'subscribed'
]).
to
be_falsey
label1_response
=
json_response
.
select
{
|
l
|
l
[
'name'
]
==
label1
.
title
}.
first
group_label_response
=
json_response
.
select
{
|
l
|
l
[
'name'
]
==
group_label
.
title
}.
first
priority_label_response
=
json_response
.
select
{
|
l
|
l
[
'name'
]
==
priority_label
.
title
}.
first
expect
(
label1_response
[
'open_issues_count'
]).
to
eq
(
0
)
expect
(
label1_response
[
'closed_issues_count'
]).
to
eq
(
1
)
expect
(
group_label_response
[
'open_issues_count'
]).
to
eq
(
1
)
expect
(
group_label_response
[
'closed_issues_count'
]).
to
eq
(
0
)
expect
(
priority_label_response
[
'open_issues_count'
]).
to
eq
(
0
)
expect
(
priority_label_response
[
'closed_issues_count'
]).
to
eq
(
0
)
expect
(
label1_response
[
'name'
]).
to
eq
(
label1
.
name
)
expect
(
label1_response
[
'color'
]).
to
be_present
expect
(
label1_response
[
'description'
]).
to
be_nil
expect
(
label1_response
[
'open_merge_requests_count'
]).
to
eq
(
0
)
expect
(
label1_response
[
'priority'
]).
to
be_nil
expect
(
label1_response
[
'subscribed'
]).
to
be_falsey
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