mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Delete dev links when repository/issue/pull/branch deleted
This commit is contained in:
@@ -64,8 +64,8 @@ func CreateIssueDevLink(ctx context.Context, link *IssueDevLink) error {
|
||||
|
||||
func DeleteIssueDevLinkByBranchName(ctx context.Context, repoID int64, branchName string) error {
|
||||
_, err := db.GetEngine(ctx).
|
||||
Where("link_type = ? AND link_index = ? AND linked_repo_id = ?",
|
||||
IssueDevLinkTypeBranch, branchName, repoID).
|
||||
Where("linked_repo_id = ? AND link_type = ? AND link_index = ?",
|
||||
repoID, IssueDevLinkTypeBranch, branchName).
|
||||
Delete(new(IssueDevLink))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -718,6 +718,10 @@ func DeleteIssuesByRepoID(ctx context.Context, repoID int64) (attachmentPaths []
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err = sess.In("issue_id", issueIDs).Delete(&IssueDevLink{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var attachments []*repo_model.Attachment
|
||||
err = sess.In("issue_id", issueIDs).Find(&attachments)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user