Skip to content

Commit 04fcf23

Browse files
authored
Delete related notifications on issue deletion too (#18953)
* use .Decr for issue comment counting * Remove notification on issue removal
1 parent 45f8d97 commit 04fcf23

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

models/issue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,6 +2124,7 @@ func deleteIssue(ctx context.Context, issue *Issue) error {
21242124
&IssueDependency{},
21252125
&IssueAssignees{},
21262126
&IssueUser{},
2127+
&Notification{},
21272128
&Reaction{},
21282129
&IssueWatch{},
21292130
&Stopwatch{},

models/issue_comment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ func deleteComment(e db.Engine, comment *Comment) error {
11631163
}
11641164

11651165
if comment.Type == CommentTypeComment {
1166-
if _, err := e.Exec("UPDATE `issue` SET num_comments = num_comments - 1 WHERE id = ?", comment.IssueID); err != nil {
1166+
if _, err := e.ID(comment.IssueID).Decr("num_comments").Update(new(Issue)); err != nil {
11671167
return err
11681168
}
11691169
}

0 commit comments

Comments
 (0)