Merge branch '56694-mark-group-level-labels-in-label-api-as-such' into 'master'
Mark group-level labels in Label API as such. Closes #56694 See merge request gitlab-org/gitlab-ce!25219
This commit is contained in:
commit
ed7144ad58
4 changed files with 28 additions and 9 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: 'API: Indicate if label is a project label'
|
||||||
|
merge_request: 25219
|
||||||
|
author: Robert Schilling
|
||||||
|
type: added
|
|
@ -30,7 +30,8 @@ Example response:
|
||||||
"closed_issues_count": 0,
|
"closed_issues_count": 0,
|
||||||
"open_merge_requests_count": 1,
|
"open_merge_requests_count": 1,
|
||||||
"subscribed": false,
|
"subscribed": false,
|
||||||
"priority": 10
|
"priority": 10,
|
||||||
|
"is_project_label": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : 4,
|
"id" : 4,
|
||||||
|
@ -42,7 +43,8 @@ Example response:
|
||||||
"closed_issues_count": 5,
|
"closed_issues_count": 5,
|
||||||
"open_merge_requests_count": 0,
|
"open_merge_requests_count": 0,
|
||||||
"subscribed": false,
|
"subscribed": false,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : 7,
|
"id" : 7,
|
||||||
|
@ -54,7 +56,8 @@ Example response:
|
||||||
"closed_issues_count": 3,
|
"closed_issues_count": 3,
|
||||||
"open_merge_requests_count": 1,
|
"open_merge_requests_count": 1,
|
||||||
"subscribed": false,
|
"subscribed": false,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : 8,
|
"id" : 8,
|
||||||
|
@ -66,7 +69,8 @@ Example response:
|
||||||
"closed_issues_count": 0,
|
"closed_issues_count": 0,
|
||||||
"open_merge_requests_count": 2,
|
"open_merge_requests_count": 2,
|
||||||
"subscribed": false,
|
"subscribed": false,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : 9,
|
"id" : 9,
|
||||||
|
@ -78,7 +82,8 @@ Example response:
|
||||||
"closed_issues_count": 0,
|
"closed_issues_count": 0,
|
||||||
"open_merge_requests_count": 1,
|
"open_merge_requests_count": 1,
|
||||||
"subscribed": true,
|
"subscribed": true,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
@ -116,7 +121,8 @@ Example response:
|
||||||
"closed_issues_count": 0,
|
"closed_issues_count": 0,
|
||||||
"open_merge_requests_count": 0,
|
"open_merge_requests_count": 0,
|
||||||
"subscribed": false,
|
"subscribed": false,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -173,7 +179,8 @@ Example response:
|
||||||
"closed_issues_count": 0,
|
"closed_issues_count": 0,
|
||||||
"open_merge_requests_count": 2,
|
"open_merge_requests_count": 2,
|
||||||
"subscribed": false,
|
"subscribed": false,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -209,7 +216,8 @@ Example response:
|
||||||
"closed_issues_count": 0,
|
"closed_issues_count": 0,
|
||||||
"open_merge_requests_count": 1,
|
"open_merge_requests_count": 1,
|
||||||
"subscribed": true,
|
"subscribed": true,
|
||||||
"priority": null
|
"priority": null,
|
||||||
|
"is_project_label": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1032,6 +1032,9 @@ module API
|
||||||
expose :priority do |label, options|
|
expose :priority do |label, options|
|
||||||
label.priority(options[:parent])
|
label.priority(options[:parent])
|
||||||
end
|
end
|
||||||
|
expose :is_project_label do |label, options|
|
||||||
|
label.is_a?(::ProjectLabel)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class List < Grape::Entity
|
class List < Grape::Entity
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe API::Labels do
|
||||||
expected_keys = %w(
|
expected_keys = %w(
|
||||||
id name color text_color description
|
id name color text_color description
|
||||||
open_issues_count closed_issues_count open_merge_requests_count
|
open_issues_count closed_issues_count open_merge_requests_count
|
||||||
subscribed priority
|
subscribed priority is_project_label
|
||||||
)
|
)
|
||||||
|
|
||||||
get api("/projects/#{project.id}/labels", user)
|
get api("/projects/#{project.id}/labels", user)
|
||||||
|
@ -47,6 +47,7 @@ describe API::Labels do
|
||||||
expect(label1_response['description']).to be_nil
|
expect(label1_response['description']).to be_nil
|
||||||
expect(label1_response['priority']).to be_nil
|
expect(label1_response['priority']).to be_nil
|
||||||
expect(label1_response['subscribed']).to be_falsey
|
expect(label1_response['subscribed']).to be_falsey
|
||||||
|
expect(label1_response['is_project_label']).to be_truthy
|
||||||
|
|
||||||
expect(group_label_response['open_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(group_label_response['closed_issues_count']).to eq(0)
|
||||||
|
@ -57,6 +58,7 @@ describe API::Labels do
|
||||||
expect(group_label_response['description']).to be_nil
|
expect(group_label_response['description']).to be_nil
|
||||||
expect(group_label_response['priority']).to be_nil
|
expect(group_label_response['priority']).to be_nil
|
||||||
expect(group_label_response['subscribed']).to be_falsey
|
expect(group_label_response['subscribed']).to be_falsey
|
||||||
|
expect(group_label_response['is_project_label']).to be_falsey
|
||||||
|
|
||||||
expect(priority_label_response['open_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(priority_label_response['closed_issues_count']).to eq(0)
|
||||||
|
@ -67,6 +69,7 @@ describe API::Labels do
|
||||||
expect(priority_label_response['description']).to be_nil
|
expect(priority_label_response['description']).to be_nil
|
||||||
expect(priority_label_response['priority']).to eq(3)
|
expect(priority_label_response['priority']).to eq(3)
|
||||||
expect(priority_label_response['subscribed']).to be_falsey
|
expect(priority_label_response['subscribed']).to be_falsey
|
||||||
|
expect(priority_label_response['is_project_label']).to be_truthy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue