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
e5a09709
Commit
e5a09709
authored
Oct 26, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update API to accept None and Any
parent
31733b6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
17 deletions
+29
-17
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+13
-13
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+14
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+2
-2
No files found.
app/finders/issuable_finder.rb
View file @
e5a09709
...
...
@@ -193,7 +193,19 @@ class IssuableFinder
end
def
filter_by_no_milestone?
milestones?
&&
params
[
:milestone_title
]
==
Milestone
::
None
.
title
[
FILTER_NONE
,
Milestone
::
None
.
title
].
include?
(
params
[
:milestone_title
].
to_s
.
downcase
)
end
def
filter_by_any_milestone?
[
FILTER_ANY
,
Milestone
::
Any
.
title
].
include?
(
params
[
:milestone_title
].
to_s
.
downcase
)
end
def
filter_by_upcoming_milestone?
params
[
:milestone_title
]
==
Milestone
::
Upcoming
.
name
end
def
filter_by_started_milestone?
params
[
:milestone_title
]
==
Milestone
::
Started
.
name
end
def
milestones
...
...
@@ -432,18 +444,6 @@ class IssuableFinder
end
# rubocop: enable CodeReuse/ActiveRecord
def
filter_by_upcoming_milestone?
params
[
:milestone_title
]
==
Milestone
::
Upcoming
.
name
end
def
filter_by_any_milestone?
params
[
:milestone_title
]
==
Milestone
::
Any
.
title
end
def
filter_by_started_milestone?
params
[
:milestone_title
]
==
Milestone
::
Started
.
name
end
# rubocop: disable CodeReuse/ActiveRecord
def
by_milestone
(
items
)
if
milestones?
...
...
spec/finders/issues_finder_spec.rb
View file @
e5a09709
...
...
@@ -144,19 +144,31 @@ describe IssuesFinder do
end
context
'filtering by no milestone'
do
let
(
:params
)
{
{
milestone_title:
Milestone
::
None
.
title
}
}
let
(
:params
)
{
{
milestone_title:
'None'
}
}
it
'returns issues with no milestone'
do
expect
(
issues
).
to
contain_exactly
(
issue2
,
issue3
,
issue4
)
end
it
'returns issues with no milestone (deprecated)'
do
params
[
:milestone_title
]
=
Milestone
::
None
.
title
expect
(
issues
).
to
contain_exactly
(
issue2
,
issue3
,
issue4
)
end
end
context
'filtering by any milestone'
do
let
(
:params
)
{
{
milestone_title:
Milestone
::
Any
.
title
}
}
let
(
:params
)
{
{
milestone_title:
'Any'
}
}
it
'returns issues with any assigned milestone'
do
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
it
'returns issues with any assigned milestone (deprecated)'
do
params
[
:milestone_title
]
=
Milestone
::
Any
.
title
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
end
context
'filtering by upcoming milestone'
do
...
...
spec/requests/api/issues_spec.rb
View file @
e5a09709
...
...
@@ -55,8 +55,8 @@ describe API::Issues do
end
let!
(
:note
)
{
create
(
:note_on_issue
,
author:
user
,
project:
project
,
noteable:
issue
)
}
let
(
:no_milestone_title
)
{
URI
.
escape
(
Milestone
::
None
.
title
)
}
let
(
:any_milestone_title
)
{
URI
.
escape
(
Milestone
::
Any
.
title
)
}
let
(
:no_milestone_title
)
{
"None"
}
let
(
:any_milestone_title
)
{
"Any"
}
before
(
:all
)
do
project
.
add_reporter
(
user
)
...
...
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