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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
858dfb20
Commit
858dfb20
authored
Nov 30, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix boards API with special milestones
parent
5f138cdd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+17
-8
ee/spec/requests/api/boards_spec.rb
ee/spec/requests/api/boards_spec.rb
+20
-0
No files found.
ee/lib/ee/api/entities.rb
View file @
858dfb20
...
...
@@ -93,17 +93,22 @@ module EE
extend
ActiveSupport
::
Concern
prepended
do
def
scoped_issue_available?
(
board
)
board
.
parent
.
feature_available?
(
:scoped_issue_board
)
end
# Default filtering configuration
expose
:name
expose
:group
expose
:milestone
,
using:
::
API
::
Entities
::
Milestone
,
if:
->
(
board
,
_
)
{
scoped_issue_available?
(
board
)
}
expose
:assignee
,
using:
::
API
::
Entities
::
UserBasic
,
if:
->
(
board
,
_
)
{
scoped_issue_available?
(
board
)
}
expose
:labels
,
using:
::
API
::
Entities
::
LabelBasic
,
if:
->
(
board
,
_
)
{
scoped_issue_available?
(
board
)
}
expose
:weight
,
if:
->
(
board
,
_
)
{
scoped_issue_available?
(
board
)
}
with_options
if:
->
(
board
,
_
)
{
board
.
parent
.
feature_available?
(
:scoped_issue_board
)
}
do
expose
:milestone
do
|
board
|
if
board
.
milestone
.
is_a?
(
Milestone
)
::
API
::
Entities
::
Milestone
.
represent
(
board
.
milestone
)
else
SpecialBoardFilter
.
represent
(
board
.
milestone
)
end
end
expose
:assignee
,
using:
::
API
::
Entities
::
UserBasic
expose
:labels
,
using:
::
API
::
Entities
::
LabelBasic
expose
:weight
end
end
end
...
...
@@ -213,6 +218,10 @@ module EE
expose
:target
,
as: :target_issue
,
using:
::
API
::
Entities
::
IssueBasic
end
class
SpecialBoardFilter
<
Grape
::
Entity
expose
:title
end
class
Approvals
<
Grape
::
Entity
expose
:user
,
using:
::
API
::
Entities
::
UserBasic
end
...
...
ee/spec/requests/api/boards_spec.rb
View file @
858dfb20
...
...
@@ -14,4 +14,24 @@ describe API::Boards do
it_behaves_like
'milestone board list'
it_behaves_like
'assignee board list'
end
context
'GET /projects/:id/boards/:board_id with special milestones'
do
let
(
:url
)
{
"/projects/
#{
board_parent
.
id
}
/boards/
#{
board
.
id
}
"
}
it
'returns board with Upcoming milestone'
do
board
.
update
(
milestone_id:
Milestone
::
Upcoming
.
id
)
get
api
(
url
,
user
)
expect
(
json_response
[
"milestone"
][
"title"
]).
to
eq
(
Milestone
::
Upcoming
.
title
)
end
it
'returns board with Started milestone'
do
board
.
update
(
milestone_id:
Milestone
::
Started
.
id
)
get
api
(
url
,
user
)
expect
(
json_response
[
"milestone"
][
"title"
]).
to
eq
(
Milestone
::
Started
.
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