diff options
author | Chantal Rollison <crollison@gitlab.com> | 2018-07-13 11:08:33 -0700 |
---|---|---|
committer | Chantal Rollison <crollison@gitlab.com> | 2018-07-13 12:32:43 -0700 |
commit | 7f97a7f512aa4b14e3552127d84afe083e801e56 (patch) | |
tree | b25f26b5d974d06b70a9418fb915a071fe4ef5bc | |
parent | 6717643c30541a95eeb99202861c43eca7ffd9b4 (diff) | |
download | gitlab-ce-ccr/group_milestone_on_dashboard.tar.gz |
Add group milestones to dashboard milestone pageccr/group_milestone_on_dashboard
-rw-r--r-- | app/controllers/dashboard/application_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/dashboard/milestones_controller.rb | 7 | ||||
-rw-r--r-- | app/models/concerns/milestoneish.rb | 4 | ||||
-rw-r--r-- | app/models/global_milestone.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/cr-add-group-milestone-to-dashboard.yml | 5 |
5 files changed, 18 insertions, 4 deletions
diff --git a/app/controllers/dashboard/application_controller.rb b/app/controllers/dashboard/application_controller.rb index 9fb5c525425..d62c1d7d99f 100644 --- a/app/controllers/dashboard/application_controller.rb +++ b/app/controllers/dashboard/application_controller.rb @@ -10,4 +10,8 @@ class Dashboard::ApplicationController < ApplicationController def projects @projects ||= current_user.authorized_projects.sorted_by_activity.non_archived end + + def groups + @groups ||= GroupsFinder.new(current_user, all_available: false).execute + end end diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb index 751dbbd8e96..30add5de393 100644 --- a/app/controllers/dashboard/milestones_controller.rb +++ b/app/controllers/dashboard/milestones_controller.rb @@ -22,7 +22,12 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController private def milestones - @milestones = DashboardMilestone.build_collection(@projects, params) + groups = GroupsFinder.new(current_user, all_available: true).execute + search_params = { + group_ids: groups.map(&:id), + project_ids: @projects + } + @milestones = DashboardMilestone.build_collection(@projects, search_params) end def milestone diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb index 967fd9c5eea..8fef16234fc 100644 --- a/app/models/concerns/milestoneish.rb +++ b/app/models/concerns/milestoneish.rb @@ -71,11 +71,11 @@ module Milestoneish end def group_milestone? - false + milestones.find { |milestone| milestone.group } end def project_milestone? - false + milestones.find { |milestone| milestone.project } end def legacy_group_milestone? diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index dc2f6817190..d944647d9d3 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -13,7 +13,7 @@ class GlobalMilestone def self.build_collection(projects, params) params = - { project_ids: projects.map(&:id), state: params[:state] } + { project_ids: projects.map(&:id), state: params[:state], group_ids: params[:group_ids] } child_milestones = MilestonesFinder.new(params).execute diff --git a/changelogs/unreleased/cr-add-group-milestone-to-dashboard.yml b/changelogs/unreleased/cr-add-group-milestone-to-dashboard.yml new file mode 100644 index 00000000000..b87a1e5faf7 --- /dev/null +++ b/changelogs/unreleased/cr-add-group-milestone-to-dashboard.yml @@ -0,0 +1,5 @@ +--- +title: Adds the ability to view group milestones on the dashboard milestone page. +merge_request: 20618 +author: +type: fixed |