From c1467f5d97c04c22e2119ace084bb016f8f53d48 Mon Sep 17 00:00:00 2001 From: Michael Greene Date: Tue, 5 Apr 2016 13:04:11 -0500 Subject: Allow back dating notes on creation --- lib/api/notes.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/api/notes.rb') diff --git a/lib/api/notes.rb b/lib/api/notes.rb index a1c98f5e8ff..71a53e6f0d6 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -61,6 +61,7 @@ module API # id (required) - The ID of a project # noteable_id (required) - The ID of an issue or snippet # body (required) - The content of a note + # created_at (optional) - The date # Example Request: # POST /projects/:id/issues/:noteable_id/notes # POST /projects/:id/snippets/:noteable_id/notes @@ -73,6 +74,10 @@ module API noteable_id: params[noteable_id_str] } + if params[:created_at] && (current_user.is_admin? || user_project.owner == current_user) + opts[:created_at] = params[:created_at] + end + @note = ::Notes::CreateService.new(user_project, current_user, opts).execute if @note.valid? -- cgit v1.2.1