Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/draft_notes.rb')
-rw-r--r--lib/api/draft_notes.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/api/draft_notes.rb b/lib/api/draft_notes.rb
index 217cd4ae325..df9e060e592 100644
--- a/lib/api/draft_notes.rb
+++ b/lib/api/draft_notes.rb
@@ -31,6 +31,12 @@ module API
.execute(get_draft_note(params: params))
end
+ def publish_draft_notes(params:)
+ ::DraftNotes::PublishService
+ .new(merge_request(params: params), current_user)
+ .execute
+ end
+
def authorize_create_note!(params:)
access_denied! unless can?(current_user, :create_note, merge_request(params: params))
end
@@ -195,6 +201,30 @@ module API
status 500
end
end
+
+ desc "Bulk publish all pending draft notes" do
+ success code: 204
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ end
+ params do
+ requires :id, type: String, desc: "The ID of a project"
+ requires :merge_request_iid, type: Integer, desc: "The ID of a merge request"
+ end
+ post(
+ ":id/merge_requests/:merge_request_iid/draft_notes/bulk_publish",
+ feature_category: :code_review_workflow) do
+ result = publish_draft_notes(params: params)
+
+ if result[:status] == :success
+ status 204
+ body false
+ else
+ status 500
+ end
+ end
end
end
end