summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2018-12-20 12:14:33 +0100
committerFatih Acet <acetfatih@gmail.com>2018-12-20 13:33:09 +0100
commite9ef02096be859e31c155174fe2784d8a7ba73e3 (patch)
treec839c271e35cd1474801ff20d90bf9be3a2135bf /app/controllers
parentf7ac8041f7ba3639085c26b4185eda00fd54a6e7 (diff)
downloadgitlab-ce-e9ef02096be859e31c155174fe2784d8a7ba73e3.tar.gz
Add project milestone link to dashboard milestonesccr/49289_milestone_link
One of the steps to deprecate dashboard milestones. Links do dashboard milestone are replaced with links for each project milestone
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/groups/milestones_controller.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb
index b42116b0f36..868deea3f01 100644
--- a/app/controllers/groups/milestones_controller.rb
+++ b/app/controllers/groups/milestones_controller.rb
@@ -43,14 +43,7 @@ class Groups::MilestonesController < Groups::ApplicationController
def update
# Keep this compatible with legacy group milestones where we have to update
# all projects milestones states at once.
- if @milestone.legacy_group_milestone?
- update_params = milestone_params.select { |key| key == "state_event" }
- milestones = @milestone.milestones
- else
- update_params = milestone_params
- milestones = [@milestone]
- end
-
+ milestones, update_params = get_milestones_for_update
milestones.each do |milestone|
Milestones::UpdateService.new(milestone.parent, current_user, update_params).execute(milestone)
end
@@ -71,6 +64,14 @@ class Groups::MilestonesController < Groups::ApplicationController
private
+ def get_milestones_for_update
+ if @milestone.legacy_group_milestone?
+ [@milestone.milestones, legacy_milestone_params]
+ else
+ [[@milestone], milestone_params]
+ end
+ end
+
def authorize_admin_milestones!
return render_404 unless can?(current_user, :admin_milestone, group)
end
@@ -79,6 +80,10 @@ class Groups::MilestonesController < Groups::ApplicationController
params.require(:milestone).permit(:title, :description, :start_date, :due_date, :state_event)
end
+ def legacy_milestone_params
+ params.require(:milestone).permit(:state_event)
+ end
+
def milestone_path
if @milestone.legacy_group_milestone?
group_milestone_path(group, @milestone.safe_title, title: @milestone.title)