summaryrefslogtreecommitdiff
path: root/lib/api/notes.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-23 12:09:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-23 12:09:47 +0000
commit8f9beefac3774b30e911fb00a68f4c7a5244cf27 (patch)
tree919c3a043f8c10bc3f78f3f6e029acfb6b972556 /lib/api/notes.rb
parente4bf776a8829e5186a0f63603c0be627b891d80e (diff)
downloadgitlab-ce-8f9beefac3774b30e911fb00a68f4c7a5244cf27.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r--lib/api/notes.rb6
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