diff options
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r-- | lib/api/notes.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 953514b6f04..759fd3a9819 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -37,7 +37,7 @@ module Gitlab # Example Request: # POST /projects/:id/notes post ":id/notes" do - bad_request!(:body) unless params[:body].present? + required_attributes! [:body] @note = user_project.notes.new(note: params[:body]) @note.author = current_user @@ -93,8 +93,7 @@ module Gitlab # POST /projects/:id/issues/:noteable_id/notes # POST /projects/:id/snippets/:noteable_id/notes post ":id/#{noteables_str}/:#{noteable_id_str}/notes" do - bad_request!(:"#{noteable_id_str}") unless params[:"#{noteable_id_str}"].present? - bad_request!(:body) unless params[:body].present? + required_attributes! [:"#{noteable_id_str}"] @noteable = user_project.send(:"#{noteables_str}").find(params[:"#{noteable_id_str}"]) @note = @noteable.notes.new(note: params[:body]) |