Skip to content

Conversation

@bircni
Copy link

@bircni bircni commented Jan 23, 2026

Summary

I added API endpoints to resolve and unresolve pull request review comments.
This mirrors the UI conversation resolve behavior and returns the updated PullReviewComment with resolver information.

Usage

New endpoints:

  • POST /repos/{owner}/{repo}/pulls/{index}/comments/{id}/resolve
  • POST /repos/{owner}/{repo}/pulls/{index}/comments/{id}/unresolve

Example:

curl -X POST -H "Authorization: token $TOKEN" -H "Accept: application/json" http://localhost:3000/api/v1/repos/OWNER/REPO/pulls/PR_INDEX/comments/COMMENT_ID/resolve

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 23, 2026
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Jan 23, 2026
@bircni bircni force-pushed the feature/review-comment-api branch from 58a4c69 to a928f12 Compare January 23, 2026 23:08
@silverwind silverwind added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jan 24, 2026
@silverwind silverwind requested a review from Copilot January 24, 2026 02:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds API endpoints to resolve and unresolve pull request review comments, providing programmatic access to functionality that previously existed only in the UI.

Changes:

  • Added POST endpoints /repos/{owner}/{repo}/pulls/{index}/comments/{id}/resolve and /repos/{owner}/{repo}/pulls/{index}/comments/{id}/unresolve
  • Refactored ToPullReviewCommentList to extract a new ToPullReviewComment function for converting single comments
  • Updated Swagger documentation to reflect the new API endpoints

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
routers/api/v1/api.go Registers the new resolve/unresolve routes with appropriate middleware for authentication and archive checks
routers/api/v1/repo/pull_review.go Implements the handler functions with permission checks, validation, and response formatting
services/convert/pull_review.go Refactors comment conversion logic to support both list and single comment conversion
templates/swagger/v1_json.tmpl Adds OpenAPI/Swagger documentation for the new endpoints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lunny
Copy link
Member

lunny commented Jan 24, 2026

It's better to add some tests

@bircni bircni force-pushed the feature/review-comment-api branch 2 times, most recently from 4f90506 to 5bff286 Compare January 24, 2026 20:00
@bircni
Copy link
Author

bircni commented Jan 24, 2026

@lunny added some tests 😄

@lunny lunny added this to the 1.26.0 milestone Jan 25, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 25, 2026
@bircni bircni requested a review from wxiaoguang January 25, 2026 09:58
Comment on lines 1363 to 1364
m.Post("/comments/{id}/resolve", reqToken(), mustNotBeArchived, repo.ResolvePullReviewComment)
m.Post("/comments/{id}/unresolve", reqToken(), mustNotBeArchived, repo.UnresolvePullReviewComment)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't need issue index, see the /issues/comments/{id}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it better go under /pulls/reviews as only review comments can be marked resolved?

Copy link
Member

@lafriks lafriks Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it could be not very useful to provide review id in url but there is already /pulls/review/{id}/comments endpoint that can be base for this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue endpoints have already deprecated the unnecessary index

// EditIssueCommentDeprecated modify a comment of an issue
func EditIssueCommentDeprecated(ctx *context.APIContext) {
	// swagger:operation PATCH /repos/{owner}/{repo}/issues/{index}/comments/{id} issue issueEditCommentDeprecated

@bircni bircni force-pushed the feature/review-comment-api branch from 56c2c02 to d10ac57 Compare January 25, 2026 15:42
@bircni bircni requested a review from wxiaoguang January 25, 2026 15:47
@wxiaoguang
Copy link
Contributor

@bircni
Copy link
Author

bircni commented Jan 25, 2026

whoops sorry 👍

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 25, 2026
Copy link
Member

@lafriks lafriks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking currently so we can discuss the best endpoint name

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Jan 25, 2026
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 26, 2026

Blocking currently so we can discuss the best endpoint name

If you'd like to edit this PR to update the endpoints, feel free to do so. But I think the current design is good enough, I don't think adding issue index makes sense, I don't think "review id" is related or necessary. Update: I have objection for adding any other unnecessary id into the endpoint.

If you don't want to edit this PR, I think we can go with this.

@wxiaoguang wxiaoguang requested a review from lafriks January 26, 2026 01:21
@wxiaoguang wxiaoguang marked this pull request as draft January 26, 2026 01:24
@wxiaoguang wxiaoguang force-pushed the feature/review-comment-api branch from b80f4ff to fa2da7b Compare January 26, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants