Expose resolver via API (#15167)

* Expose resolver via API
This commit is contained in:
sotho 2021-03-28 00:37:51 +01:00 committed by GitHub
parent 290cf75f93
commit e7609929c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View file

@ -66,7 +66,7 @@ func TestAPIPullReview(t *testing.T) {
var reviewComments []*api.PullReviewComment var reviewComments []*api.PullReviewComment
DecodeJSON(t, resp, &reviewComments) DecodeJSON(t, resp, &reviewComments)
assert.Len(t, reviewComments, 1) assert.Len(t, reviewComments, 1)
assert.EqualValues(t, "Ghost", reviewComments[0].Reviewer.UserName) assert.EqualValues(t, "Ghost", reviewComments[0].Poster.UserName)
assert.EqualValues(t, "a review from a deleted user", reviewComments[0].Body) assert.EqualValues(t, "a review from a deleted user", reviewComments[0].Body)
assert.EqualValues(t, comment.ID, reviewComments[0].ID) assert.EqualValues(t, comment.ID, reviewComments[0].ID)
assert.EqualValues(t, comment.UpdatedUnix, reviewComments[0].Updated.Unix()) assert.EqualValues(t, comment.UpdatedUnix, reviewComments[0].Updated.Unix())

View file

@ -86,7 +86,8 @@ func ToPullReviewCommentList(review *models.Review, doer *models.User) ([]*api.P
apiComment := &api.PullReviewComment{ apiComment := &api.PullReviewComment{
ID: comment.ID, ID: comment.ID,
Body: comment.Content, Body: comment.Content,
Reviewer: ToUser(comment.Poster, doer), Poster: ToUser(comment.Poster, doer),
Resolver: ToUser(comment.ResolveDoer, doer),
ReviewID: review.ID, ReviewID: review.ID,
Created: comment.CreatedUnix.AsTime(), Created: comment.CreatedUnix.AsTime(),
Updated: comment.UpdatedUnix.AsTime(), Updated: comment.UpdatedUnix.AsTime(),

View file

@ -49,7 +49,8 @@ type PullReview struct {
type PullReviewComment struct { type PullReviewComment struct {
ID int64 `json:"id"` ID int64 `json:"id"`
Body string `json:"body"` Body string `json:"body"`
Reviewer *User `json:"user"` Poster *User `json:"user"`
Resolver *User `json:"resolver"`
ReviewID int64 `json:"pull_request_review_id"` ReviewID int64 `json:"pull_request_review_id"`
// swagger:strfmt date-time // swagger:strfmt date-time

View file

@ -15460,6 +15460,9 @@
"type": "string", "type": "string",
"x-go-name": "HTMLPullURL" "x-go-name": "HTMLPullURL"
}, },
"resolver": {
"$ref": "#/definitions/User"
},
"updated_at": { "updated_at": {
"type": "string", "type": "string",
"format": "date-time", "format": "date-time",