summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorOtto Richter (fnetX) <git@fralix.ovh>2022-03-17 23:04:09 +0100
committerGitHub <noreply@github.com>2022-03-17 23:04:09 +0100
commit04fcf23ea39a0be9e9b85a10e0cee19d8e28c35b (patch)
treeafe432c267bd79617cbdd30cfa2a27dcecfa6d38 /models
parent45f8d971317422de704beeb901fda899c71e96df (diff)
downloadgitea-04fcf23ea39a0be9e9b85a10e0cee19d8e28c35b.tar.gz
gitea-04fcf23ea39a0be9e9b85a10e0cee19d8e28c35b.zip
Delete related notifications on issue deletion too (#18953)
* use .Decr for issue comment counting * Remove notification on issue removal
Diffstat (limited to 'models')
-rw-r--r--models/issue.go1
-rw-r--r--models/issue_comment.go2
2 files changed, 2 insertions, 1 deletions
diff --git a/models/issue.go b/models/issue.go
index ed94195ed1..53ee585dc0 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -2124,6 +2124,7 @@ func deleteIssue(ctx context.Context, issue *Issue) error {
&IssueDependency{},
&IssueAssignees{},
&IssueUser{},
+ &Notification{},
&Reaction{},
&IssueWatch{},
&Stopwatch{},
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 0af45e80e8..8390d90f8a 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -1163,7 +1163,7 @@ func deleteComment(e db.Engine, comment *Comment) error {
}
if comment.Type == CommentTypeComment {
- if _, err := e.Exec("UPDATE `issue` SET num_comments = num_comments - 1 WHERE id = ?", comment.IssueID); err != nil {
+ if _, err := e.ID(comment.IssueID).Decr("num_comments").Update(new(Issue)); err != nil {
return err
}
}