Skip to content

Commit 7c2ef9b

Browse files
fnetX6543
authored andcommitted
Delete related notifications on issue deletion too (go-gitea#18953)
* use .Decr for issue comment counting * Remove notification on issue removal
1 parent afe98af commit 7c2ef9b

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
@@ -2076,6 +2076,7 @@ func deleteIssue(ctx context.Context, issue *Issue) error {
20762076
&IssueDependency{},
20772077
&IssueAssignees{},
20782078
&IssueUser{},
2079+
&Notification{},
20792080
&Reaction{},
20802081
&IssueWatch{},
20812082
&Stopwatch{},

models/issue_comment.go

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

11741174
if comment.Type == CommentTypeComment {
1175-
if _, err := e.Exec("UPDATE `issue` SET num_comments = num_comments - 1 WHERE id = ?", comment.IssueID); err != nil {
1175+
if _, err := e.ID(comment.IssueID).Decr("num_comments").Update(new(Issue)); err != nil {
11761176
return err
11771177
}
11781178
}

0 commit comments

Comments
 (0)