1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-16 18:01:33 +00:00

Dont load Review if Comment is CommentTypeReviewRequest (#28551) (#29160)

Backport #28551

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

(cherry picked from commit 0ac3186267b717bce7076ef44f883df7720d7a2d)
This commit is contained in:
6543 2024-02-13 23:29:33 +01:00 committed by Earl Warren
parent 60a4c05d23
commit d3846df1f9
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 12 additions and 1 deletions

View file

@ -688,8 +688,15 @@ func (c *Comment) LoadReactions(ctx context.Context, repo *repo_model.Repository
}
func (c *Comment) loadReview(ctx context.Context) (err error) {
if c.ReviewID == 0 {
return nil
}
if c.Review == nil {
if c.Review, err = GetReviewByID(ctx, c.ReviewID); err != nil {
// review request which has been replaced by actual reviews doesn't exist in database anymore, so ignorem them.
if c.Type == CommentTypeReviewRequest {
return nil
}
return err
}
}