diff options
author | Sean McGivern <sean@gitlab.com> | 2019-05-06 11:59:02 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-05-06 19:48:32 +0100 |
commit | 00af4c6d6a8ea2997f57d6e872992b9fc72839d8 (patch) | |
tree | bab3f5402cb060788713c62040a483fa0cfddda1 /lib/api/discussions.rb | |
parent | 0a7c9660e61ad7af24fd3cb93097bf283e5c9b34 (diff) | |
download | gitlab-ce-00af4c6d6a8ea2997f57d6e872992b9fc72839d8.tar.gz |
Allow replying to an individual note in the APIallow-replying-to-individual-notes-from-api
If you can do this in the UI, you should be able to do it in the API. If
a discussion is not a single note discussion, or it is replyable, you
can reply to it.
Diffstat (limited to 'lib/api/discussions.rb')
-rw-r--r-- | lib/api/discussions.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/discussions.rb b/lib/api/discussions.rb index 8afe6dda414..5928ee1657b 100644 --- a/lib/api/discussions.rb +++ b/lib/api/discussions.rb @@ -134,9 +134,13 @@ module API post ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id/notes" do noteable = find_noteable(parent_type, noteables_str, params[:noteable_id]) notes = readable_discussion_notes(noteable, params[:discussion_id]) + first_note = notes.first break not_found!("Discussion") if notes.empty? - break bad_request!("Discussion is an individual note.") unless notes.first.part_of_discussion? + + unless first_note.part_of_discussion? || first_note.to_discussion.can_convert_to_discussion? + break bad_request!("Discussion can not be replied to.") + end opts = { note: params[:body], |