1
0
mirror of https://github.com/go-gitea/gitea synced 2024-12-24 03:35:55 +01:00

Delete dependencies when deleting a repository (#10608)

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
Lauris BH 2020-03-05 09:58:02 +02:00 committed by GitHub
parent 6420f17fb6
commit 6a57364dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1520,6 +1520,18 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
return err
}
// Dependencies for issues in this repository
if _, err = sess.In("issue_id", deleteCond).
Delete(&IssueDependency{}); err != nil {
return err
}
// Delete dependencies for issues in other repositories
if _, err = sess.In("dependency_id", deleteCond).
Delete(&IssueDependency{}); err != nil {
return err
}
if _, err = sess.In("issue_id", deleteCond).
Delete(&IssueUser{}); err != nil {
return err