From 245d6ebda5ab89eb84d99c803c6d50f67cc6147e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 19 Apr 2020 04:39:48 +0200 Subject: [PATCH] On Repo Deletion: Delete related TrackedTimes too (#11110) (#11125) --- models/repo.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/repo.go b/models/repo.go index 7e2cfd947..b5a9395ed 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1968,6 +1968,11 @@ func DeleteRepository(doer *User, uid, repoID int64) error { return err } + if _, err = sess.In("issue_id", deleteCond). + Delete(&TrackedTime{}); err != nil { + return err + } + attachments = attachments[:0] if err = sess.Join("INNER", "issue", "issue.id = attachment.issue_id"). Where("issue.repo_id = ?", repoID).