Commit bfdd0247 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '50006-expose-textcolor-from-public-labels-api' into 'master'

Resolve "Expose textcolor from public labels API"

Closes #50006

See merge request gitlab-org/gitlab-ce!25172
parents 559169f6 2a5ca841
---
title: 'API: Expose text_color for project and group labels'
merge_request: 25172
author: Robert Schilling
type: added
......@@ -28,6 +28,7 @@ Example response:
"id": 7,
"name": "bug",
"color": "#FF0000",
"text_color" : "#FFFFFF",
"description": null,
"open_issues_count": 0,
"closed_issues_count": 0,
......@@ -38,6 +39,7 @@ Example response:
"id": 4,
"name": "feature",
"color": "#228B22",
"text_color" : "#FFFFFF",
"description": null,
"open_issues_count": 0,
"closed_issues_count": 0,
......@@ -73,6 +75,7 @@ Example response:
"id": 9,
"name": "Feature Proposal",
"color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas",
"open_issues_count": 0,
"closed_issues_count": 0,
......@@ -108,6 +111,7 @@ Example response:
"id": 9,
"name": "Feature Idea",
"color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas",
"open_issues_count": 0,
"closed_issues_count": 0,
......@@ -158,6 +162,7 @@ Example response:
"id": 9,
"name": "Feature Idea",
"color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas",
"open_issues_count": 0,
"closed_issues_count": 0,
......@@ -192,6 +197,7 @@ Example response:
"id": 9,
"name": "Feature Idea",
"color": "#FFA500",
"text_color" : "#FFFFFF",
"description": "Describes new ideas",
"open_issues_count": 0,
"closed_issues_count": 0,
......
......@@ -24,6 +24,7 @@ Example response:
"id" : 1,
"name" : "bug",
"color" : "#d9534f",
"text_color" : "#FFFFFF",
"description": "Bug reported by user",
"open_issues_count": 1,
"closed_issues_count": 0,
......@@ -34,6 +35,7 @@ Example response:
{
"id" : 4,
"color" : "#d9534f",
"text_color" : "#FFFFFF",
"name" : "confirmed",
"description": "Confirmed issue",
"open_issues_count": 2,
......@@ -46,6 +48,7 @@ Example response:
"id" : 7,
"name" : "critical",
"color" : "#d9534f",
"text_color" : "#FFFFFF",
"description": "Critical issue. Need fix ASAP",
"open_issues_count": 1,
"closed_issues_count": 3,
......@@ -57,6 +60,7 @@ Example response:
"id" : 8,
"name" : "documentation",
"color" : "#f0ad4e",
"text_color" : "#FFFFFF",
"description": "Issue about documentation",
"open_issues_count": 1,
"closed_issues_count": 0,
......@@ -67,6 +71,7 @@ Example response:
{
"id" : 9,
"color" : "#5cb85c",
"text_color" : "#FFFFFF",
"name" : "enhancement",
"description": "Enhancement proposal",
"open_issues_count": 1,
......@@ -105,6 +110,7 @@ Example response:
"id" : 10,
"name" : "feature",
"color" : "#5843AD",
"text_color" : "#FFFFFF",
"description":null,
"open_issues_count": 0,
"closed_issues_count": 0,
......@@ -161,6 +167,7 @@ Example response:
"id" : 8,
"name" : "docs",
"color" : "#8E44AD",
"text_color" : "#FFFFFF",
"description": "Documentation",
"open_issues_count": 1,
"closed_issues_count": 0,
......@@ -196,6 +203,7 @@ Example response:
"id" : 1,
"name" : "bug",
"color" : "#d9534f",
"text_color" : "#FFFFFF",
"description": "Bug reported by user",
"open_issues_count": 1,
"closed_issues_count": 0,
......
......@@ -1003,7 +1003,7 @@ module API
end
class LabelBasic < Grape::Entity
expose :id, :name, :color, :description
expose :id, :name, :color, :description, :text_color
end
class Label < LabelBasic
......
......@@ -6,6 +6,7 @@
"id" : { "type": "integer" },
"name" : { "type": "string "},
"color" : { "type": "string "},
"text_color" : { "type": "string "},
"description" : { "type": "string "},
"open_issues_count" : { "type": "integer "},
"closed_issues_count" : { "type": "integer "},
......
......@@ -20,7 +20,7 @@ describe API::Labels do
create(:labeled_merge_request, labels: [priority_label], author: user, source_project: project )
expected_keys = %w(
id name color description
id name color text_color description
open_issues_count closed_issues_count open_merge_requests_count
subscribed priority
)
......@@ -43,6 +43,7 @@ describe API::Labels do
expect(label1_response['open_merge_requests_count']).to eq(0)
expect(label1_response['name']).to eq(label1.name)
expect(label1_response['color']).to be_present
expect(label1_response['text_color']).to be_present
expect(label1_response['description']).to be_nil
expect(label1_response['priority']).to be_nil
expect(label1_response['subscribed']).to be_falsey
......@@ -52,6 +53,7 @@ describe API::Labels do
expect(group_label_response['open_merge_requests_count']).to eq(0)
expect(group_label_response['name']).to eq(group_label.name)
expect(group_label_response['color']).to be_present
expect(group_label_response['text_color']).to be_present
expect(group_label_response['description']).to be_nil
expect(group_label_response['priority']).to be_nil
expect(group_label_response['subscribed']).to be_falsey
......@@ -61,6 +63,7 @@ describe API::Labels do
expect(priority_label_response['open_merge_requests_count']).to eq(1)
expect(priority_label_response['name']).to eq(priority_label.name)
expect(priority_label_response['color']).to be_present
expect(priority_label_response['text_color']).to be_present
expect(priority_label_response['description']).to be_nil
expect(priority_label_response['priority']).to eq(3)
expect(priority_label_response['subscribed']).to be_falsey
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment