summaryrefslogtreecommitdiff
path: root/app/controllers/groups
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-08-28 07:49:09 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-08-28 07:49:09 +0000
commit722631a9290e07cc0d83baf7bf332223ab7cf8b6 (patch)
tree3e1b00852e04cb76236a985e57a3afa6d37ebc68 /app/controllers/groups
parent881ba3f5977dafda7feee77f841ace290c918a8d (diff)
parentabb50ff4710e264c0c700df88757ee3ab1cf7dfb (diff)
downloadgitlab-ce-722631a9290e07cc0d83baf7bf332223ab7cf8b6.tar.gz
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/groups')
-rw-r--r--app/controllers/groups/milestones_controller.rb17
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