1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

[Backport] Fix Deadlock & Delete affected reactions on comment deletion (#14392) (#14425)

* Enhance Ghost comment mitigation Settings (#14392)

* refactor models.DeleteComment and delete related reactions too

* use deleteComment for UserDeleteWithCommentsMaxDays in DeleteUser

* Resolve Fixme & fix potential deadlock

* rm refactor

* make diff eaven less
This commit is contained in:
6543
2021-01-23 03:03:29 +01:00
committed by GitHub
parent fb274ec54b
commit 4d2a6c40f8
5 changed files with 23 additions and 14 deletions

View File

@@ -178,11 +178,15 @@ func CreateCommentReaction(doer *User, issue *Issue, comment *Comment, content s
})
}
func deleteReaction(e *xorm.Session, opts *ReactionOptions) error {
func deleteReaction(e Engine, opts *ReactionOptions) error {
reaction := &Reaction{
Type: opts.Type,
UserID: opts.Doer.ID,
IssueID: opts.Issue.ID,
Type: opts.Type,
}
if opts.Doer != nil {
reaction.UserID = opts.Doer.ID
}
if opts.Issue != nil {
reaction.IssueID = opts.Issue.ID
}
if opts.Comment != nil {
reaction.CommentID = opts.Comment.ID