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
Léo-Paul Géneau
gitlab-ce
Commits
86e0b5d6
Commit
86e0b5d6
authored
Oct 14, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue board related controllers to expose label priority per project
parent
3c2aaec1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
6 deletions
+34
-6
app/controllers/projects/boards/issues_controller.rb
app/controllers/projects/boards/issues_controller.rb
+2
-2
app/controllers/projects/boards/lists_controller.rb
app/controllers/projects/boards/lists_controller.rb
+2
-3
app/models/issue.rb
app/models/issue.rb
+12
-0
app/models/label.rb
app/models/label.rb
+6
-0
app/models/list.rb
app/models/list.rb
+11
-0
spec/fixtures/api/schemas/list.json
spec/fixtures/api/schemas/list.json
+1
-1
No files found.
app/controllers/projects/boards/issues_controller.rb
View file @
86e0b5d6
...
...
@@ -72,10 +72,10 @@ module Projects
def
serialize_as_json
(
resource
)
resource
.
as_json
(
labels:
true
,
only:
[
:iid
,
:title
,
:confidential
],
include:
{
assignee:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
labels:
{
only:
[
:id
,
:title
,
:description
,
:color
,
:priority
],
methods:
[
:text_color
]
}
assignee:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
}
})
end
end
...
...
app/controllers/projects/boards/lists_controller.rb
View file @
86e0b5d6
...
...
@@ -76,9 +76,8 @@ module Projects
resource
.
as_json
(
only:
[
:id
,
:list_type
,
:position
],
methods:
[
:title
],
include:
{
label:
{
only:
[
:id
,
:title
,
:description
,
:color
,
:priority
]
}
})
label:
true
)
end
end
end
...
...
app/models/issue.rb
View file @
86e0b5d6
...
...
@@ -274,4 +274,16 @@ class Issue < ActiveRecord::Base
def
check_for_spam?
project
.
public?
end
def
as_json
(
options
=
{})
super
(
options
).
tap
do
|
json
|
if
options
.
has_key?
(
:labels
)
json
[
:labels
]
=
labels
.
as_json
(
project:
project
,
only:
[
:id
,
:title
,
:description
,
:color
],
methods:
[
:text_color
]
)
end
end
end
end
app/models/label.rb
View file @
86e0b5d6
...
...
@@ -133,6 +133,12 @@ class Label < ActiveRecord::Base
end
end
def
as_json
(
options
=
{})
super
(
options
).
tap
do
|
json
|
json
[
:priority
]
=
priorities
.
find_by
(
project:
options
[
:project
]).
try
(
:priority
)
if
options
.
has_key?
(
:project
)
end
end
private
def
cross_project_reference?
(
source_project
,
target_project
)
...
...
app/models/list.rb
View file @
86e0b5d6
...
...
@@ -26,6 +26,17 @@ class List < ActiveRecord::Base
label?
?
label
.
name
:
list_type
.
humanize
end
def
as_json
(
options
=
{})
super
(
options
).
tap
do
|
json
|
if
options
.
has_key?
(
:label
)
json
[
:label
]
=
label
.
as_json
(
project:
board
.
project
,
only:
[
:id
,
:title
,
:description
,
:color
]
)
end
end
end
private
def
can_be_destroyed
...
...
spec/fixtures/api/schemas/list.json
View file @
86e0b5d6
...
...
@@ -13,7 +13,7 @@
"enum"
:
[
"backlog"
,
"label"
,
"done"
]
},
"label"
:
{
"type"
:
[
"object"
],
"type"
:
[
"object"
,
"null"
],
"required"
:
[
"id"
,
"color"
,
...
...
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