Skip to content

Commit 7e86dff

Browse files
authored
Load reviewer for comments when dismissing a review (#24281) (#24288)
1 parent 7297cce commit 7e86dff

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

models/issues/comment_list.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (comments CommentList) getLabelIDs() []int64 {
5656
return ids.Values()
5757
}
5858

59-
func (comments CommentList) loadLabels(ctx context.Context) error { //nolint
59+
func (comments CommentList) loadLabels(ctx context.Context) error {
6060
if len(comments) == 0 {
6161
return nil
6262
}
@@ -415,7 +415,7 @@ func (comments CommentList) getReviewIDs() []int64 {
415415
return ids.Values()
416416
}
417417

418-
func (comments CommentList) loadReviews(ctx context.Context) error { //nolint
418+
func (comments CommentList) loadReviews(ctx context.Context) error {
419419
if len(comments) == 0 {
420420
return nil
421421
}
@@ -453,6 +453,14 @@ func (comments CommentList) loadReviews(ctx context.Context) error { //nolint
453453

454454
for _, comment := range comments {
455455
comment.Review = reviews[comment.ReviewID]
456+
457+
// If the comment dismisses a review, we need to load the reviewer to show whose review has been dismissed.
458+
// Otherwise, the reviewer is the poster of the comment, so we don't need to load it.
459+
if comment.Type == CommentTypeDismissReview {
460+
if err := comment.Review.LoadReviewer(ctx); err != nil {
461+
return err
462+
}
463+
}
456464
}
457465
return nil
458466
}

0 commit comments

Comments
 (0)