diff options
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r-- | lib/api/notes.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 7237fa24bab..3eafc1ead77 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -82,9 +82,13 @@ module API note = create_note(noteable, opts) - if note.valid? + if note.errors.keys == [:commands_only] + status 202 + present note, with: Entities::NoteCommands + elsif note.valid? present note, with: Entities.const_get(note.class.name, false) else + note.errors.delete(:commands_only) if note.errors.has_key?(:commands) bad_request!("Note #{note.errors.messages}") end end |