Skip to content

Commit

Permalink
Fix ToPullReview.
Browse files Browse the repository at this point in the history
  • Loading branch information
KN4CK3R committed Jan 11, 2024
1 parent 73621e3 commit e737433
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions services/convert/pull_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model.
r.Reviewer = user_model.NewGhostUser()
}

apiTeam, err := ToTeam(ctx, r.ReviewerTeam)
if err != nil {
return nil, err
}

result := &api.PullReview{
ID: r.ID,
Reviewer: ToUser(ctx, r.Reviewer, doer),
ReviewerTeam: apiTeam,
State: api.ReviewStateUnknown,
Body: r.Content,
CommitID: r.CommitID,
Expand All @@ -43,6 +37,14 @@ func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model.
HTMLPullURL: r.Issue.HTMLURL(),
}

if r.ReviewerTeam != nil {
var err error
result.ReviewerTeam, err = ToTeam(ctx, r.ReviewerTeam)
if err != nil {
return nil, err
}
}

switch r.Type {
case issues_model.ReviewTypeApprove:
result.State = api.ReviewStateApproved
Expand Down

0 comments on commit e737433

Please sign in to comment.