diff options
author | Simon Knox <psimyn@gmail.com> | 2017-09-06 14:35:58 +1000 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-09-06 14:35:58 +1000 |
commit | b9aa55e1ea2ba226bd9bf4c6fb08fdec30e046c5 (patch) | |
tree | b7770180f178086c78ef2ca25d6bb2267f739110 /lib/api/notes.rb | |
parent | 74740604211dab6632771f1bfd7dd67902fea7ef (diff) | |
parent | d68ff7f50a93ebbff537b5e795cf6bf80bd66a6e (diff) | |
download | gitlab-ce-b9aa55e1ea2ba226bd9bf4c6fb08fdec30e046c5.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ee_issue_928_backport
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r-- | lib/api/notes.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 4e4e473994b..d6e7203adaf 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -9,7 +9,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects, requirements: { id: %r{[^/]+} } do + resource :projects, requirements: API::PROJECT_ENDPOINT_REQUIREMENTS do NOTEABLE_TYPES.each do |noteable_type| noteables_str = noteable_type.to_s.underscore.pluralize @@ -129,10 +129,12 @@ module API end delete ":id/#{noteables_str}/:noteable_id/notes/:note_id" do note = user_project.notes.find(params[:note_id]) + authorize! :admin_note, note - status 204 - ::Notes::DestroyService.new(user_project, current_user).execute(note) + destroy_conditionally!(note) do |note| + ::Notes::DestroyService.new(user_project, current_user).execute(note) + end end end end |