diff options
author | 6543 | 2020-09-03 11:23:36 +0200 |
---|---|---|
committer | GitHub | 2020-09-03 17:23:36 +0800 |
commit | 0fa538e552aa213f079a8a303496fe93ea24eb54 (patch) | |
tree | fbd2ac539cd490d5f606cc7945d00f355e150588 | |
parent | 69e4b6910b024ec99521c1ca570ed4d232e11247 (diff) |
[Backport] Fix comment broken issue ref dependence (#12651) (#12692)
* deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too
* Ignore ErrIssueNotExist on comment.LoadDepIssueDetails()
* CI.restart()
-rw-r--r-- | models/issue.go | 5 | ||||
-rw-r--r-- | routers/repo/issue.go | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go index 1a4de26b3..05eed6a78 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1953,6 +1953,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 { diff --git a/routers/repo/issue.go b/routers/repo/issue.go index afe64c731..6000d12b4 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -969,8 +969,10 @@ func ViewIssue(ctx *context.Context) { } } else if comment.Type == models.CommentTypeRemoveDependency || comment.Type == models.CommentTypeAddDependency { if err = comment.LoadDepIssueDetails(); err != nil { - ctx.ServerError("LoadDepIssueDetails", err) - return + if !models.IsErrIssueNotExist(err) { + ctx.ServerError("LoadDepIssueDetails", err) + return + } } } else if comment.Type == models.CommentTypeCode || comment.Type == models.CommentTypeReview { comment.RenderedContent = string(markdown.Render([]byte(comment.Content), ctx.Repo.RepoLink, |