Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong user returned in API: GET /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments #15127

Closed
1 of 4 tasks
sotho opened this issue Mar 23, 2021 · 2 comments · Fixed by #15139
Closed
1 of 4 tasks
Labels

Comments

@sotho
Copy link
Contributor

sotho commented Mar 23, 2021

Description

I use the API to download the comments of a review.
In the returned json all comments have the the same user, although the comments were done by different users (as can be seen in the web frontend).

In modules/convert/pull_review.go ToPullReviewCommentList uses the reviewer, but I think it should use the poster of the comment. This fixes it for me:

--- a/modules/convert/pull_review.go
+++ b/modules/convert/pull_review.go
@@ -94,7 +94,7 @@ func ToPullReviewCommentList(review *models.Review, doer *models.User) ([]*api.P
                apiComment := &api.PullReviewComment{
                    ID:           comment.ID,
                    Body:         comment.Content,
-                   Reviewer:     ToUser(review.Reviewer, doer != nil, auth),
+                   Reviewer:     ToUser(comment.Poster, doer != nil, auth),
                    ReviewID:     review.ID,
                    Created:      comment.CreatedUnix.AsTime(),
                    Updated:      comment.UpdatedUnix.AsTime(),
@a1012112796
Copy link
Member

@sotho Hello, Thanks for your response, would you please send a pull request to fix it?Thanks.

sotho added a commit to sotho/gitea that referenced this issue Mar 24, 2021
The API call: GET /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments
returns always the reviewer, but should return the poster.
@sotho
Copy link
Contributor Author

sotho commented Mar 24, 2021

Pull request #15139 opened

@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants