BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6b4da27e
Commit
6b4da27e
authored
Jul 07, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dashboard labels dropdown
parent
de2d5ce6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
4 deletions
+39
-4
labels_controller.rb
app/controllers/dashboard/labels_controller.rb
+7
-2
global_label.rb
app/models/global_label.rb
+1
-1
label_entity.rb
app/serializers/label_entity.rb
+2
-1
34590-fix-dashboard-labels-dropdown.yml
...gelogs/unreleased/34590-fix-dashboard-labels-dropdown.yml
+4
-0
labels_controller_spec.rb
spec/controllers/dashboard/labels_controller_spec.rb
+25
-0
No files found.
app/controllers/dashboard/labels_controller.rb
View file @
6b4da27e
class
Dashboard
::
LabelsController
<
Dashboard
::
ApplicationController
def
index
labels
=
LabelsFinder
.
new
(
current_user
).
execute
respond_to
do
|
format
|
format
.
json
{
render
json:
LabelSerializer
.
new
.
represent_appearance
(
labels
)
}
end
end
def
labels
finder_params
=
{
project_ids:
projects
.
select
(
:id
)
}
labels
=
LabelsFinder
.
new
(
current_user
,
finder_params
).
execute
GlobalLabel
.
build_collection
(
labels
)
end
end
app/models/global_label.rb
View file @
6b4da27e
...
...
@@ -2,7 +2,7 @@ class GlobalLabel
attr_accessor
:title
,
:labels
alias_attribute
:name
,
:title
delegate
:color
,
:description
,
to: :@first_label
delegate
:color
,
:
text_color
,
:
description
,
to: :@first_label
def
for_display
@first_label
...
...
app/serializers/label_entity.rb
View file @
6b4da27e
class
LabelEntity
<
Grape
::
Entity
expose
:id
expose
:id
,
if:
->
(
label
,
_
)
{
!
label
.
is_a?
(
GlobalLabel
)
}
expose
:title
expose
:color
expose
:description
...
...
changelogs/unreleased/34590-fix-dashboard-labels-dropdown.yml
0 → 100644
View file @
6b4da27e
---
title
:
Fix dashboard labels dropdown
merge_request
:
12708
author
:
spec/controllers/dashboard/labels_controller_spec.rb
0 → 100644
View file @
6b4da27e
require
'spec_helper'
describe
Dashboard
::
LabelsController
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
before
do
sign_in
(
user
)
project
.
add_reporter
(
user
)
end
describe
"#index"
do
let!
(
:unrelated_label
)
{
create
(
:label
,
project:
create
(
:empty_project
,
:public
))
}
it
'returns global labels for projects the user has a relationship with'
do
get
:index
,
format: :json
expect
(
json_response
).
to
be_kind_of
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
[
0
][
"id"
]).
to
be_nil
expect
(
json_response
[
0
][
"title"
]).
to
eq
(
label
.
title
)
end
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