diff options
author | 6543 <6543@obermui.de> | 2020-09-04 03:36:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 09:36:56 +0800 |
commit | 6c5266c9cadf500ec8a166066bf4452801cc2545 (patch) | |
tree | 5f32a7e3a8438e07ea013f8a2db0069460795dc9 /models/issue.go | |
parent | 42a5e39b3bb17cf006a5d04887148a5ea9719f32 (diff) | |
download | gitea-6c5266c9cadf500ec8a166066bf4452801cc2545.tar.gz gitea-6c5266c9cadf500ec8a166066bf4452801cc2545.zip |
[BugFix] Fix comment broken issue ref dependence (#12651)
* deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too
* Ignore ErrIssueNotExist on comment.LoadDepIssueDetails()
* Add migration
* Ignore 'dependent_issue_id = 0' case
* exchange as per @lunny
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go index 2912f7e8ef..81652771ba 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1978,6 +1978,11 @@ func deleteIssuesByRepoID(sess Engine, repoID int64) (attachmentPaths []string, return } + if _, err = sess.In("dependent_issue_id", deleteCond). + Delete(&Comment{}); err != nil { + return + } + var attachments []*Attachment if err = sess.In("issue_id", deleteCond). Find(&attachments); err != nil { |