Print pull dont crash if it has TeamReviewRequests (#517)

partial backport of #515

Reviewed-on: https://gitea.com/gitea/tea/pulls/517
Reviewed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
6543 2022-09-29 20:35:57 +08:00
parent 6c9b2f8745
commit c00418e74c
1 changed files with 5 additions and 2 deletions

View File

@ -99,8 +99,11 @@ func formatReviews(reviews []*gitea.PullReview) string {
case gitea.ReviewStateApproved,
gitea.ReviewStateRequestChanges,
gitea.ReviewStateRequestReview:
if r, ok := reviewByUser[review.Reviewer.ID]; !ok || review.Submitted.After(r.Submitted) {
reviewByUser[review.Reviewer.ID] = review
// only user reviews are supported no team review requests
if review.Reviewer != nil {
if r, ok := reviewByUser[review.Reviewer.ID]; !ok || review.Submitted.After(r.Submitted) {
reviewByUser[review.Reviewer.ID] = review
}
}
}
}