0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-26 11:04:27 -04:00
This commit is contained in:
Lunny Xiao 2025-07-02 10:59:33 -07:00
parent 0cf45c3f0e
commit 681ffa6ff1
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A

View File

@ -46,15 +46,22 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
}
}
func shouldSendCommentChangeNotification(ctx context.Context, comment *issues_model.Comment) bool {
if err := comment.LoadReview(ctx); err != nil {
log.Error("LoadReview: %v", err)
return false
} else if comment.Review != nil && comment.Review.Type == issues_model.ReviewTypePending {
// Pending review comments updating should not triggered
return false
}
return true
}
// CreateIssueComment notifies issue comment related message to notifiers
func CreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository,
issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
) {
if err := comment.LoadReview(ctx); err != nil {
log.Error("LoadReview: %v", err)
return
} else if comment.Review != nil && comment.Review.Type == issues_model.ReviewTypePending {
// Pending review comments updating should not triggered
if !shouldSendCommentChangeNotification(ctx, comment) {
return
}
@ -164,11 +171,7 @@ func PullReviewDismiss(ctx context.Context, doer *user_model.User, review *issue
// UpdateComment notifies update comment to notifiers
func UpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment, oldContent string) {
if err := c.LoadReview(ctx); err != nil {
log.Error("LoadReview: %v", err)
return
} else if c.Review != nil && c.Review.Type == issues_model.ReviewTypePending {
// Pending review comments updating should not triggered
if !shouldSendCommentChangeNotification(ctx, c) {
return
}
@ -179,11 +182,7 @@ func UpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.C
// DeleteComment notifies delete comment to notifiers
func DeleteComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment) {
if err := c.LoadReview(ctx); err != nil {
log.Error("LoadReview: %v", err)
return
} else if c.Review != nil && c.Review.Type == issues_model.ReviewTypePending {
// Pending review comments updating should not triggered
if !shouldSendCommentChangeNotification(ctx, c) {
return
}