Add resolve/unresolve review comment API endpoints#36441
Add resolve/unresolve review comment API endpoints#36441wxiaoguang merged 7 commits intogo-gitea:mainfrom
Conversation
58a4c69 to
a928f12
Compare
There was a problem hiding this comment.
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}/resolveand/repos/{owner}/{repo}/pulls/{index}/comments/{id}/unresolve - Refactored
ToPullReviewCommentListto extract a newToPullReviewCommentfunction 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.
|
It's better to add some tests |
4f90506 to
5bff286
Compare
|
@lunny added some tests 😄 |
routers/api/v1/api.go
Outdated
| m.Post("/comments/{id}/resolve", reqToken(), mustNotBeArchived, repo.ResolvePullReviewComment) | ||
| m.Post("/comments/{id}/unresolve", reqToken(), mustNotBeArchived, repo.UnresolvePullReviewComment) |
There was a problem hiding this comment.
It doesn't need issue index, see the /issues/comments/{id}
There was a problem hiding this comment.
Should it better go under /pulls/reviews as only review comments can be marked resolved?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
56c2c02 to
d10ac57
Compare
b80f4ff to
fa2da7b
Compare
delvh
left a comment
There was a problem hiding this comment.
Naming sounds fine, especially as GitHub does not seem to support any such route in their API, so we can't look at it.
|
@delvh @wxiaoguang i renamed all occurences of |
|
ping @lafriks |
|
@lafriks whats the final decision? Can you unblock it? |
|
@lafriks ping |
|
I still believe that the same item's endpoints should be grouped together. Currently we have What other @go-gitea/maintainers think? |
Then you need to answer 2 questions before just saying "believe that the same item's endpoints should be grouped together":
|
|
I don't believe it's the best design but as issue comments follow the same pattern I won't block |
I'm ok that it follows general pattern as with issue comments
Still don't understand why you "don't believe it's the best design" since the questions are still not answered. |
|
Something seems wrong with this merge, other PRs show unrelated error: |
|
Actually no, it's just a bug in #36457. |
* giteaofficial/main: (26 commits) [skip ci] Updated translations via Crowdin Remove and forbid `@ts-expect-error` (go-gitea#36513) Add resolve/unresolve review comment API endpoints (go-gitea#36441) Fix incorrect vendored detections (go-gitea#36508) Bump alpine to 3.23, add platforms to `docker-dryrun` (go-gitea#36379) Unify repo names in system notices (go-gitea#36491) Allow scroll propagation outside code editor (go-gitea#36502) Refactor ActionsTaskID (go-gitea#36503) Update JS deps, remove `knip`, misc tweaks (go-gitea#36499) [skip ci] Updated translations via Crowdin Fix editorconfig not respected in PR Conversation view (go-gitea#36492) Add FOLDER_ICON_THEME configuration option (go-gitea#36496) Don't create self-references in merged PRs (go-gitea#36490) Use reserved .test TLD for unit tests (go-gitea#36498) Fix bug when list pull request commits (go-gitea#36485) Update some go dependencies (go-gitea#36489) chore: add comments for "api/healthz", clean up test env (go-gitea#36481) [SECURITY] Toolchain Update to Go 1.25.6 (go-gitea#36480) [skip ci] Updated translations via Crowdin Render merged pull request title as such in dashboard feed (go-gitea#36479) ...
* origin/main: (1246 commits) fix(packages/container): data race when uploading container blobs concurrently (go-gitea#36524) [skip ci] Updated translations via Crowdin Remove and forbid `@ts-expect-error` (go-gitea#36513) Add resolve/unresolve review comment API endpoints (go-gitea#36441) Fix incorrect vendored detections (go-gitea#36508) Bump alpine to 3.23, add platforms to `docker-dryrun` (go-gitea#36379) Unify repo names in system notices (go-gitea#36491) Allow scroll propagation outside code editor (go-gitea#36502) Refactor ActionsTaskID (go-gitea#36503) Update JS deps, remove `knip`, misc tweaks (go-gitea#36499) [skip ci] Updated translations via Crowdin Fix editorconfig not respected in PR Conversation view (go-gitea#36492) Add FOLDER_ICON_THEME configuration option (go-gitea#36496) Don't create self-references in merged PRs (go-gitea#36490) Use reserved .test TLD for unit tests (go-gitea#36498) Fix bug when list pull request commits (go-gitea#36485) Update some go dependencies (go-gitea#36489) chore: add comments for "api/healthz", clean up test env (go-gitea#36481) [SECURITY] Toolchain Update to Go 1.25.6 (go-gitea#36480) [skip ci] Updated translations via Crowdin ... # Conflicts: # modules/templates/helper.go # options/locale/locale_en-US.ini # routers/web/repo/cherry_pick.go # routers/web/repo/editor.go # routers/web/repo/patch.go # templates/repo/editor/edit.tmpl # web_src/js/features/codeeditor.ts
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:
/repos/{owner}/{repo}/pulls/{index}/comments/{id}/resolve/repos/{owner}/{repo}/pulls/{index}/comments/{id}/unresolveExample: