Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load reviewer for comments when dismissing a review #24281

Merged
merged 5 commits into from
Apr 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions models/issues/comment_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (comments CommentList) getLabelIDs() []int64 {
return ids.Values()
}

func (comments CommentList) loadLabels(ctx context.Context) error { //nolint
func (comments CommentList) loadLabels(ctx context.Context) error {
if len(comments) == 0 {
return nil
}
Expand Down Expand Up @@ -415,7 +415,7 @@ func (comments CommentList) getReviewIDs() []int64 {
return ids.Values()
}

func (comments CommentList) loadReviews(ctx context.Context) error { //nolint
func (comments CommentList) loadReviews(ctx context.Context) error {
if len(comments) == 0 {
return nil
}
Expand Down Expand Up @@ -453,6 +453,14 @@ func (comments CommentList) loadReviews(ctx context.Context) error { //nolint

for _, comment := range comments {
comment.Review = reviews[comment.ReviewID]

// If the comment dismisses a review, we need to load the reviewer to show whose review has been dismissed.
// Otherwise, the reviewer is the poster of the comment, so we don't need to load it.
if comment.Type == CommentTypeDismissReview {
if err := comment.Review.LoadReviewer(ctx); err != nil {
return err
}
}
}
return nil
}
Expand Down