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
e580c226
Commit
e580c226
authored
Sep 10, 2018
by
Chantal Rollison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter group milestones based on user membership
parent
c7d1eef6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
6 deletions
+14
-6
app/controllers/dashboard/milestones_controller.rb
app/controllers/dashboard/milestones_controller.rb
+1
-1
app/models/dashboard_group_milestone.rb
app/models/dashboard_group_milestone.rb
+1
-1
changelogs/unreleased/ccr-50483_add_filter_for_group_milestones.yml
.../unreleased/ccr-50483_add_filter_for_group_milestones.yml
+5
-0
spec/controllers/dashboard/milestones_controller_spec.rb
spec/controllers/dashboard/milestones_controller_spec.rb
+5
-3
spec/features/dashboard/milestones_spec.rb
spec/features/dashboard/milestones_spec.rb
+2
-1
No files found.
app/controllers/dashboard/milestones_controller.rb
View file @
e580c226
...
...
@@ -22,7 +22,7 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
private
def
group_milestones
groups
=
GroupsFinder
.
new
(
current_user
,
all_available:
tru
e
).
execute
groups
=
GroupsFinder
.
new
(
current_user
,
all_available:
fals
e
).
execute
DashboardGroupMilestone
.
build_collection
(
groups
)
end
...
...
app/models/dashboard_group_milestone.rb
View file @
e580c226
...
...
@@ -13,7 +13,7 @@ class DashboardGroupMilestone < GlobalMilestone
end
def
self
.
build_collection
(
groups
)
MilestonesFinder
.
new
(
group_ids:
groups
.
pluck
(
:id
)).
execute
.
map
{
|
m
|
new
(
m
)
}
# rubocop: disable CodeReuse/Finder
MilestonesFinder
.
new
(
group_ids:
groups
.
select
(
:id
)).
execute
.
map
{
|
m
|
new
(
m
)
}
# rubocop: disable CodeReuse/Finder
end
override
:group_milestone?
...
...
changelogs/unreleased/ccr-50483_add_filter_for_group_milestones.yml
0 → 100644
View file @
e580c226
---
title
:
Filter group milestones based on user membership.
merge_request
:
21660
author
:
type
:
fixed
spec/controllers/dashboard/milestones_controller_spec.rb
View file @
e580c226
...
...
@@ -3,9 +3,11 @@ require 'spec_helper'
describe
Dashboard
::
MilestonesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:public_group
)
{
create
(
:group
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project_milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:group_milestone
)
{
create
(
:milestone
,
group:
group
)
}
let!
(
:public_milestone
)
{
create
(
:milestone
,
group:
public_group
)
}
let
(
:milestone
)
do
DashboardMilestone
.
build
(
[
project
],
...
...
@@ -43,13 +45,13 @@ describe Dashboard::MilestonesController do
end
describe
"#index"
do
it
'
should contain group and project milestone
s'
do
it
'
returns group and project milestones to which the user belong
s'
do
get
:index
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
json_response
.
map
{
|
i
|
i
[
"first_milestone"
][
"id"
]
}).
to
include
(
group_milestone
.
id
,
project_milestone
.
id
)
expect
(
json_response
.
map
{
|
i
|
i
[
"group_name"
]
}
).
to
include
(
group
.
name
)
expect
(
json_response
.
map
{
|
i
|
i
[
"first_milestone"
][
"id"
]
}).
to
match_array
([
group_milestone
.
id
,
project_milestone
.
id
]
)
expect
(
json_response
.
map
{
|
i
|
i
[
"group_name"
]
}
.
compact
).
to
match_array
(
group
.
name
)
end
end
end
spec/features/dashboard/milestones_spec.rb
View file @
e580c226
...
...
@@ -17,8 +17,9 @@ describe 'Dashboard > Milestones' do
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:milestone2
)
{
create
(
:milestone
,
group:
group
)
}
before
do
project
.
add_maintain
er
(
user
)
group
.
add_develop
er
(
user
)
sign_in
(
user
)
visit
dashboard_milestones_path
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