Skip to content

Commit

Permalink
Delete related notifications on issue deletion too (go-gitea#18953)
Browse files Browse the repository at this point in the history
* use .Decr for issue comment counting

* Remove notification on issue removal
  • Loading branch information
fnetX authored and Stelios Malathouras committed Mar 28, 2022
1 parent 389e7a8 commit dcf2c29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,7 @@ func deleteIssue(ctx context.Context, issue *Issue) error {
&IssueDependency{},
&IssueAssignees{},
&IssueUser{},
&Notification{},
&Reaction{},
&IssueWatch{},
&Stopwatch{},
Expand Down
2 changes: 1 addition & 1 deletion models/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit dcf2c29

Please sign in to comment.