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
6ff16f4b
Commit
6ff16f4b
authored
Jul 16, 2019
by
blunceford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug with closed milestones in dashboard
parent
b8d876f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
app/models/dashboard_group_milestone.rb
app/models/dashboard_group_milestone.rb
+1
-2
spec/controllers/dashboard/milestones_controller_spec.rb
spec/controllers/dashboard/milestones_controller_spec.rb
+22
-0
No files found.
app/models/dashboard_group_milestone.rb
View file @
6ff16f4b
...
...
@@ -15,8 +15,7 @@ class DashboardGroupMilestone < GlobalMilestone
milestones
=
Milestone
.
of_groups
(
groups
.
select
(
:id
))
.
reorder_by_due_date_asc
.
order_by_name_asc
.
active
milestones
=
milestones
.
search_title
(
params
[
:search_title
])
if
params
[
:search_title
].
present?
milestones
.
map
{
|
m
|
new
(
m
)
}
Milestone
.
filter_by_state
(
milestones
,
params
[
:state
])
.
map
{
|
m
|
new
(
m
)
}
end
end
spec/controllers/dashboard/milestones_controller_spec.rb
View file @
6ff16f4b
...
...
@@ -59,6 +59,18 @@ describe Dashboard::MilestonesController do
expect
(
json_response
.
map
{
|
i
|
i
[
"group_name"
]
}.
compact
).
to
match_array
(
group
.
name
)
end
it
'returns closed group and project milestones to which the user belongs'
do
closed_group_milestone
=
create
(
:milestone
,
group:
group
,
state:
'closed'
)
closed_project_milestone
=
create
(
:milestone
,
project:
project
,
state:
'closed'
)
get
:index
,
params:
{
state:
'closed'
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
json_response
.
map
{
|
i
|
i
[
"name"
]
}).
to
match_array
([
closed_group_milestone
.
name
,
closed_project_milestone
.
name
])
expect
(
json_response
.
map
{
|
i
|
i
[
"group_name"
]
}.
compact
).
to
match_array
(
group
.
name
)
end
it
'searches legacy project milestones by title when search_title is given'
do
project_milestone
=
create
(
:milestone
,
title:
'Project milestone title'
,
project:
project
)
...
...
@@ -84,6 +96,16 @@ describe Dashboard::MilestonesController do
expect
(
response
.
body
).
to
include
(
"Closed
\n
<span class=
\"
badge badge-pill
\"
>0</span>"
)
end
it
'shows counts of closed group and project milestones to which the user belongs to'
do
closed_group_milestone
=
create
(
:milestone
,
group:
group
,
state:
'closed'
)
closed_project_milestone
=
create
(
:milestone
,
project:
project
,
state:
'closed'
)
get
:index
expect
(
response
.
body
).
to
include
(
"Open
\n
<span class=
\"
badge badge-pill
\"
>2</span>"
)
expect
(
response
.
body
).
to
include
(
"Closed
\n
<span class=
\"
badge badge-pill
\"
>2</span>"
)
end
context
'external authorization'
do
subject
{
get
:index
}
...
...
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