Add in_reply_to field for threading pull review comments via API#36903
Closed
fredriksvan wants to merge 2 commits intogo-gitea:mainfrom
Closed
Add in_reply_to field for threading pull review comments via API#36903fredriksvan wants to merge 2 commits intogo-gitea:mainfrom
fredriksvan wants to merge 2 commits intogo-gitea:mainfrom
Conversation
Allow API consumers to thread review comments under existing review conversations by specifying the review ID (pull_request_review_id) in the in_reply_to field of CreatePullReviewComment. Reply comments are posted immediately (not as pending review comments) using the existing CreateCodeComment service with replyReviewID. When a request contains only reply comments with no body, the endpoint returns 204 No Content instead of creating a spurious empty review. Mixed requests (replies + new comments) are supported: replies are posted immediately while new comments go through the normal pending review flow.
The Review.Comments field is not populated by LoadAttributes. Use LoadCodeComments which populates Review.CodeComments (map[path]map[line][]*Comment) to verify the reply was threaded.
Member
|
This is basically a duplicate to #36683, but that PR uses |
Author
|
Thanks for pointing out #36683 — closing this in favor of that PR. Looking forward to the feature landing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently the API for creating pull request reviews (
POST /repos/{owner}/{repo}/pulls/{index}/reviews) does not support threading comments under existing review conversations. The web UI usesreplyReviewIDin theCreateCodeCommentservice to thread replies, but the API hardcodes this to0.This PR adds an
in_reply_tofield toCreatePullReviewCommentthat accepts apull_request_review_id, allowing API consumers to post threaded replies to existing review conversations.Changes
modules/structs/pull_review.go: AddedInReplyTo int64field toCreatePullReviewCommentrouters/api/v1/repo/pull_review.go: Separates reply comments (posted immediately viaCreateCodeCommentwithreplyReviewID) from pending comments. Reply-only requests return204 No Contentinstead of creating empty reviews. Swagger docs updated with 204 responsetemplates/swagger/v1_json.tmpl: Regenerated swagger spectests/integration/api_pull_review_test.go: AddedTestAPIPullReviewCommentReplycovering reply-only (204) and mixed reply + pending comment scenariosBehavior
in_reply_to(existing behavior)