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
Jérome Perrin
gitlab-ce
Commits
d00cb00d
Commit
d00cb00d
authored
Jun 28, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename NoMilestone to Milestone::None
Also refactors IssuableFinder to avoid redundant title check.
parent
cfd81340
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
24 deletions
+10
-24
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+3
-8
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+1
-1
app/models/milestone.rb
app/models/milestone.rb
+4
-0
app/models/no_milestone.rb
app/models/no_milestone.rb
+0
-13
spec/features/issues/filter_by_milestone_spec.rb
spec/features/issues/filter_by_milestone_spec.rb
+1
-1
spec/features/merge_requests/filter_by_milestone_spec.rb
spec/features/merge_requests/filter_by_milestone_spec.rb
+1
-1
No files found.
app/finders/issuable_finder.rb
View file @
d00cb00d
...
...
@@ -10,7 +10,7 @@
# state: 'open' or 'closed' or 'all'
# group_id: integer
# project_id: integer
# milestone_
id: integer
# milestone_
title: string
# assignee_id: integer
# search: string
# label_name: string
...
...
@@ -76,7 +76,7 @@ class IssuableFinder
return
@milestones
if
defined?
(
@milestones
)
@milestones
=
if
milestones?
&&
params
[
:milestone_title
]
!=
NoMilest
one
.
title
if
milestones?
&&
params
[
:milestone_title
]
!=
Milestone
::
N
one
.
title
Milestone
.
where
(
title:
params
[
:milestone_title
])
else
nil
...
...
@@ -183,12 +183,7 @@ class IssuableFinder
def
by_milestone
(
items
)
if
milestones?
# `milestone_title` will still be present when "No Milestone" is selected
if
params
[
:milestone_title
]
!=
NoMilestone
.
title
items
=
items
.
where
(
milestone_id:
milestones
.
try
(
:pluck
,
:id
))
else
items
=
items
.
where
(
milestone_id:
NoMilestone
.
id
)
end
items
=
items
.
where
(
milestone_id:
milestones
.
try
(
:pluck
,
:id
))
end
items
...
...
app/helpers/milestones_helper.rb
View file @
d00cb00d
...
...
@@ -29,7 +29,7 @@ module MilestonesHelper
end
.
active
grouped_milestones
=
Milestones
::
GroupService
.
new
(
milestones
).
execute
grouped_milestones
.
unshift
(
NoMilest
one
)
grouped_milestones
.
unshift
(
Milestone
::
N
one
)
options_from_collection_for_select
(
grouped_milestones
,
'title'
,
'title'
,
params
[
:milestone_title
])
end
...
...
app/models/milestone.rb
View file @
d00cb00d
...
...
@@ -14,6 +14,10 @@
#
class
Milestone
<
ActiveRecord
::
Base
# Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned.
None
=
Struct
.
new
(
:title
).
new
(
'No Milestone'
)
include
InternalId
include
Sortable
...
...
app/models/no_milestone.rb
deleted
100644 → 0
View file @
cfd81340
# NoMilestone
#
# Represents a "No Milestone" state used for filtering Issues and Merge Requests
# that have no milestone assigned.
class
NoMilestone
def
self
.
id
nil
end
def
self
.
title
'No Milestone'
end
end
spec/features/issues/filter_by_milestone_spec.rb
View file @
d00cb00d
...
...
@@ -13,7 +13,7 @@ feature 'Issue filtering by Milestone' do
create
(
:issue
,
project:
project
)
visit_issues
filter_by_milestone
(
NoMilest
one
.
title
)
filter_by_milestone
(
Milestone
::
N
one
.
title
)
expect
(
page
).
to
have_css
(
'.issue-title'
,
count:
1
)
end
...
...
spec/features/merge_requests/filter_by_milestone_spec.rb
View file @
d00cb00d
...
...
@@ -13,7 +13,7 @@ feature 'Merge Request filtering by Milestone' do
create
(
:merge_request
,
:simple
,
source_project:
project
)
visit_merge_requests
filter_by_milestone
(
NoMilest
one
.
title
)
filter_by_milestone
(
Milestone
::
N
one
.
title
)
expect
(
page
).
to
have_css
(
'.merge-request-title'
,
count:
1
)
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