diff --git a/modules/convert/pull_review.go b/modules/convert/pull_review.go index 032d3617fc234..238f43c253762 100644 --- a/modules/convert/pull_review.go +++ b/modules/convert/pull_review.go @@ -83,19 +83,18 @@ func ToPullReviewCommentList(review *models.Review, doer *models.User) ([]*api.P apiComments := make([]*api.PullReviewComment, 0, len(review.CodeComments)) - auth := false - if doer != nil { - auth = doer.IsAdmin || doer.ID == review.ReviewerID - } - for _, lines := range review.CodeComments { for _, comments := range lines { for _, comment := range comments { + auth := false + if doer != nil { + auth = doer.IsAdmin || doer.ID == comment.Poster.ID + } apiComment := &api.PullReviewComment{ ID: comment.ID, Body: comment.Content, - Reviewer: ToUser(review.Reviewer, doer != nil, auth), - ReviewID: review.ID, + Reviewer: ToUser(comment.Poster, doer != nil, auth), + ReviewID: comment.PosterID, Created: comment.CreatedUnix.AsTime(), Updated: comment.UpdatedUnix.AsTime(), Path: comment.TreePath,