Delete dependencies when deleting a repository (#10608) (#10616)

Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lauris BH <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
This commit is contained in:
zeripath
2020-03-05 13:56:53 +00:00
committed by GitHub
co-authored by GitHub Lauris BH
parent fd85d31cb4
commit c19ac41b34
+12
View File
@@ -1856,6 +1856,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