Skip to content

Commit 0fa538e

Browse files
authored
[Backport] Fix comment broken issue ref dependence (#12651) (#12692)
* deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too * Ignore ErrIssueNotExist on comment.LoadDepIssueDetails() * CI.restart()
1 parent 69e4b69 commit 0fa538e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

models/issue.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,11 @@ func deleteIssuesByRepoID(sess Engine, repoID int64) (attachmentPaths []string,
19531953
return
19541954
}
19551955

1956+
if _, err = sess.In("dependent_issue_id", deleteCond).
1957+
Delete(&Comment{}); err != nil {
1958+
return
1959+
}
1960+
19561961
var attachments []*Attachment
19571962
if err = sess.In("issue_id", deleteCond).
19581963
Find(&attachments); err != nil {

routers/repo/issue.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,10 @@ func ViewIssue(ctx *context.Context) {
969969
}
970970
} else if comment.Type == models.CommentTypeRemoveDependency || comment.Type == models.CommentTypeAddDependency {
971971
if err = comment.LoadDepIssueDetails(); err != nil {
972-
ctx.ServerError("LoadDepIssueDetails", err)
973-
return
972+
if !models.IsErrIssueNotExist(err) {
973+
ctx.ServerError("LoadDepIssueDetails", err)
974+
return
975+
}
974976
}
975977
} else if comment.Type == models.CommentTypeCode || comment.Type == models.CommentTypeReview {
976978
comment.RenderedContent = string(markdown.Render([]byte(comment.Content), ctx.Repo.RepoLink,

0 commit comments

Comments
 (0)