diff options
author | James Lopez <james@gitlab.com> | 2019-05-07 07:22:58 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-05-07 07:22:58 +0000 |
commit | bd73925b858cbb7229b3d335da0e5d0023f57caf (patch) | |
tree | f08771eeb4c270cc645f26c716bc63bf3606e322 /lib | |
parent | b3490d516c710b26f0b33e68ed0046c8dd8564e0 (diff) | |
parent | 00af4c6d6a8ea2997f57d6e872992b9fc72839d8 (diff) | |
download | gitlab-ce-bd73925b858cbb7229b3d335da0e5d0023f57caf.tar.gz |
Merge branch 'allow-replying-to-individual-notes-from-api' into 'master'
Allow replying to an individual note in the API
Closes #61392
See merge request gitlab-org/gitlab-ce!28120
Diffstat (limited to 'lib')
-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], |