From 887817a4e21906c647f335df58f7e106ec72dd3f Mon Sep 17 00:00:00 2001 From: fnetx Date: Tue, 1 Mar 2022 10:02:14 +0100 Subject: [PATCH 1/2] use .Decr for issue comment counting --- models/issue_comment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index 0af45e80e8b3a..8390d90f8a688 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 } } From 465a42fdf6f75cc3b74395ba0d5bce7e3905239b Mon Sep 17 00:00:00 2001 From: fnetx Date: Thu, 17 Mar 2022 13:45:51 +0100 Subject: [PATCH 2/2] Remove notification on issue removal --- models/issue.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/issue.go b/models/issue.go index fd59ac0a4b495..ba352dacb96c5 100644 --- a/models/issue.go +++ b/models/issue.go @@ -2075,6 +2075,7 @@ func deleteIssue(ctx context.Context, issue *Issue) error { &IssueDependency{}, &IssueAssignees{}, &IssueUser{}, + &Notification{}, &Reaction{}, &IssueWatch{}, &Stopwatch{},