mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 21:03:56 +01:00
Improve the deletion of issue (#18945)
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
f8898c30dc
commit
04971c33a3
1 changed files with 9 additions and 9 deletions
|
@ -2043,17 +2043,17 @@ func deleteIssue(ctx context.Context, issue *Issue) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete actions assigned to this issue
|
// delete actions assigned to this issue
|
||||||
var comments []int64
|
subQuery := builder.Select("`id`").
|
||||||
if err := e.Table(new(Comment)).In("issue_id", issue.ID).Cols("id").Find(&comments); err != nil {
|
From("`comment`").
|
||||||
|
Where(builder.Eq{"`issue_id`": issue.ID})
|
||||||
|
if _, err := e.In("comment_id", subQuery).Delete(&Action{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for i := range comments {
|
|
||||||
if _, err := e.Where("comment_id = ?", comments[i]).Delete(&Action{}); err != nil {
|
if _, err := e.Table("action").Where("repo_id = ?", issue.RepoID).
|
||||||
return err
|
In("op_type", ActionCreateIssue, ActionCreatePullRequest).
|
||||||
}
|
Where("content LIKE ?", strconv.FormatInt(issue.ID, 10)+"|%").
|
||||||
}
|
Delete(&Action{}); err != nil {
|
||||||
if _, err := e.Table("action").Where("repo_id = ?", issue.RepoID).In("op_type", ActionCreateIssue, ActionCreatePullRequest).
|
|
||||||
Where("content LIKE ?", strconv.FormatInt(issue.ID, 10)+"|%").Delete(&Action{}); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue