diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-28 10:49:09 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-28 10:49:09 +0300 |
commit | 722631a9290e07cc0d83baf7bf332223ab7cf8b6 (patch) | |
tree | 3e1b00852e04cb76236a985e57a3afa6d37ebc68 /app/controllers | |
parent | 881ba3f5977dafda7feee77f841ace290c918a8d (diff) | |
parent | abb50ff4710e264c0c700df88757ee3ab1cf7dfb (diff) |
Merge branch 'issue_36138' into 'master'
Allow to delete group milestones
Closes #36138
See merge request gitlab-org/gitlab-ce!21057
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/groups/milestones_controller.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 9bd51de7e97..6bdc0f79ef2 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -2,8 +2,8 @@ class Groups::MilestonesController < Groups::ApplicationController include MilestoneActions before_action :group_projects - before_action :milestone, only: [:edit, :show, :update, :merge_requests, :participants, :labels] - before_action :authorize_admin_milestones!, only: [:edit, :new, :create, :update] + before_action :milestone, only: [:edit, :show, :update, :merge_requests, :participants, :labels, :destroy] + before_action :authorize_admin_milestones!, only: [:edit, :new, :create, :update, :destroy] def index respond_to do |format| @@ -56,10 +56,21 @@ class Groups::MilestonesController < Groups::ApplicationController redirect_to milestone_path end + def destroy + return render_404 if @milestone.legacy_group_milestone? + + Milestones::DestroyService.new(group, current_user).execute(@milestone) + + respond_to do |format| + format.html { redirect_to group_milestones_path(group), status: :see_other } + format.js { head :ok } + end + end + private def authorize_admin_milestones! - return render_404 unless can?(current_user, :admin_milestones, group) + return render_404 unless can?(current_user, :admin_milestone, group) end def milestone_params |