From 4be7cf04054e5eab3b2cf4a63ad31a9333ab4732 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 18 Apr 2020 23:39:23 +0200 Subject: [PATCH] On Repo Deletion: Delete related TrackedTimes too (#11110) --- models/repo.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/repo.go b/models/repo.go index a901c3476b..438066e0da 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1614,6 +1614,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).