Browse Source

[Backport] Fix comment broken issue ref dependence (#12651) (#12692)

* deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too

* Ignore ErrIssueNotExist on comment.LoadDepIssueDetails()

* CI.restart()
tags/v1.12.4
6543 3 years ago
parent
commit
0fa538e552
No account linked to committer's email address
2 changed files with 9 additions and 2 deletions
  1. 5
    0
      models/issue.go
  2. 4
    2
      routers/repo/issue.go

+ 5
- 0
models/issue.go View File

@@ -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 {

+ 4
- 2
routers/repo/issue.go View File

@@ -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,

Loading…
Cancel
Save