Dont load Review if Comment is CommentTypeReviewRequest (#28551)

RequestReview get deleted on review.
So we don't have to try to load them on comments.

broken out #28544
This commit is contained in:
6543 authored and GitHub committed 2024-02-13 09:45:31 +01:00
1 parent b85e4a64fa
commit 6fad2c8744
3 files changed
+12 -1

No files matched your search

+2 -1
View File
@@ -430,7 +430,8 @@ func (comments CommentList) loadReviews(ctx context.Context) error {
for _, comment := range comments {
comment.Review = reviews[comment.ReviewID]
if comment.Review == nil {
if comment.ReviewID > 0 {
// review request which has been replaced by actual reviews doesn't exist in database anymore, so don't log errors for them.
if comment.ReviewID > 0 && comment.Type != CommentTypeReviewRequest {
log.Error("comment with review id [%d] but has no review record", comment.ReviewID)
}
continue