summaryrefslogtreecommitdiff
path: root/app/controllers/projects/milestones_controller.rb
diff options
context:
space:
mode:
authorFelipe Artur <fcardozo@gitlab.com>2017-10-31 15:03:52 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-10-31 15:03:52 +0000
commit2f8577d45e996aaee078106686647a3034f1c78b (patch)
treef43d288e85ec2a890b7379e95bf4f36c1e282142 /app/controllers/projects/milestones_controller.rb
parentbd33a8290a34048b90818280edeb4e597de8a6ed (diff)
downloadgitlab-ce-2f8577d45e996aaee078106686647a3034f1c78b.tar.gz
Allow promoting project milestones to group milestones
Diffstat (limited to 'app/controllers/projects/milestones_controller.rb')
-rw-r--r--app/controllers/projects/milestones_controller.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb
index c94384d2a1a..980bbf699b6 100644
--- a/app/controllers/projects/milestones_controller.rb
+++ b/app/controllers/projects/milestones_controller.rb
@@ -2,13 +2,13 @@ class Projects::MilestonesController < Projects::ApplicationController
include MilestoneActions
before_action :check_issuables_available!
- before_action :milestone, only: [:edit, :update, :destroy, :show, :merge_requests, :participants, :labels]
+ before_action :milestone, only: [:edit, :update, :destroy, :show, :merge_requests, :participants, :labels, :promote]
# Allow read any milestone
before_action :authorize_read_milestone!
# Allow admin milestone
- before_action :authorize_admin_milestone!, except: [:index, :show, :merge_requests, :participants, :labels]
+ before_action :authorize_admin_milestone!, except: [:index, :show, :merge_requests, :participants, :labels, :promote]
respond_to :html
@@ -69,6 +69,14 @@ class Projects::MilestonesController < Projects::ApplicationController
end
end
+ def promote
+ promoted_milestone = Milestones::PromoteService.new(project, current_user).execute(milestone)
+ flash[:notice] = "Milestone has been promoted to group milestone."
+ redirect_to group_milestone_path(project.group, promoted_milestone.iid)
+ rescue Milestones::PromoteService::PromoteMilestoneError => error
+ redirect_to milestone, alert: error.message
+ end
+
def destroy
return access_denied! unless can?(current_user, :admin_milestone, @project)