summaryrefslogtreecommitdiff
path: root/lib/api/notes.rb
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2012-11-29 15:52:56 -0800
committerNihad Abbasov <narkoz.2008@gmail.com>2012-11-29 15:52:56 -0800
commitee6187bd554f6f257600a67f65f8af95cf9afa9a (patch)
tree64796fc07332ea345d0a68c7eaf21e6a2367c715 /lib/api/notes.rb
parent2a98a060caccd82ec8cd9bcead886142f766c069 (diff)
downloadgitlab-ce-ee6187bd554f6f257600a67f65f8af95cf9afa9a.tar.gz
API: ability to create a wall note
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r--lib/api/notes.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb
index 924eeaa3618..b47ff5c300f 100644
--- a/lib/api/notes.rb
+++ b/lib/api/notes.rb
@@ -17,6 +17,24 @@ module Gitlab
present paginate(@notes), with: Entities::Note
end
+ # Create a new project wall note
+ #
+ # Parameters:
+ # id (required) - The ID or code name of a project
+ # body (required) - The content of a note
+ # Example Request:
+ # POST /projects/:id/notes
+ post ":id/notes" do
+ @note = user_project.notes.new(note: params[:body])
+ @note.author = current_user
+
+ if @note.save
+ present @note, with: Entities::Note
+ else
+ not_found!
+ end
+ end
+
NOTEABLE_TYPES.each do |noteable_type|
noteables_str = noteable_type.to_s.underscore.pluralize
noteable_id_str = "#{noteable_type.to_s.underscore}_id"