diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-08-06 22:02:52 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-08-06 23:31:47 +0300 |
commit | abb50ff4710e264c0c700df88757ee3ab1cf7dfb (patch) | |
tree | a77ce62f4384becfe7b36fa1ae7fea700895812f /lib/api | |
parent | cb2e07309b4e61501a44c3568155bdb73252338f (diff) |
Allow to delete group milestones
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/group_milestones.rb | 14 | ||||
-rw-r--r-- | lib/api/project_milestones.rb | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/api/group_milestones.rb b/lib/api/group_milestones.rb index 93fa0b95857..4b4352c2b27 100644 --- a/lib/api/group_milestones.rb +++ b/lib/api/group_milestones.rb @@ -41,7 +41,7 @@ module API use :optional_params end post ":id/milestones" do - authorize! :admin_milestones, user_group + authorize! :admin_milestone, user_group create_milestone_for(user_group) end @@ -53,11 +53,21 @@ module API use :update_params end put ":id/milestones/:milestone_id" do - authorize! :admin_milestones, user_group + authorize! :admin_milestone, user_group update_milestone_for(user_group) end + desc 'Remove a project milestone' + delete ":id/milestones/:milestone_id" do + authorize! :admin_milestone, user_group + + milestone = user_group.milestones.find(params[:milestone_id]) + Milestones::DestroyService.new(user_group, current_user).execute(milestone) + + status(204) + end + desc 'Get all issues for a single group milestone' do success Entities::IssueBasic end diff --git a/lib/api/project_milestones.rb b/lib/api/project_milestones.rb index 306dc0e63d7..72cf32d7717 100644 --- a/lib/api/project_milestones.rb +++ b/lib/api/project_milestones.rb @@ -64,7 +64,8 @@ module API delete ":id/milestones/:milestone_id" do authorize! :admin_milestone, user_project - user_project.milestones.find(params[:milestone_id]).destroy + milestone = user_project.milestones.find(params[:milestone_id]) + Milestones::DestroyService.new(user_project, current_user).execute(milestone) status(204) end |