diff --git a/models/issue.go b/models/issue.go index 3d3e433a4..7dd69267a 100644 --- a/models/issue.go +++ b/models/issue.go @@ -167,6 +167,8 @@ type IssueUser struct { Uid int64 // User ID. IssueId int64 RepoId int64 + MilestoneId int64 + Labels string `xorm:"TEXT"` IsRead bool IsAssigned bool IsMentioned bool diff --git a/models/repo.go b/models/repo.go index 4382bd7dc..0594c6c6f 100644 --- a/models/repo.go +++ b/models/repo.go @@ -676,15 +676,33 @@ func DeleteRepository(userId, repoId int64, userName string) (err error) { sess.Rollback() return err } - if _, err = sess.Delete(&Issue{RepoId: repoId}); err != nil { + if _, err = sess.Delete(&IssueUser{RepoId: repoId}); err != nil { sess.Rollback() return err } - if _, err = sess.Delete(&IssueUser{RepoId: repoId}); err != nil { + if _, err = sess.Delete(&Milestone{RepoId: repoId}); err != nil { sess.Rollback() return err } - if _, err = sess.Delete(&Milestone{RepoId: repoId}); err != nil { + if _, err = sess.Delete(&Release{RepoId: repoId}); err != nil { + sess.Rollback() + return err + } + + // Delete comments. + if err = orm.Iterate(&Issue{RepoId: repoId}, func(idx int, bean interface{}) error { + issue := bean.(*Issue) + if _, err = sess.Delete(&Comment{IssueId: issue.Id}); err != nil { + sess.Rollback() + return err + } + return nil + }); err != nil { + sess.Rollback() + return err + } + + if _, err = sess.Delete(&Issue{RepoId: repoId}); err != nil { sess.Rollback() return err } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 7b8c912e6..db0eff9cd 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -63,6 +63,7 @@ func Issues(ctx *middleware.Context) { } mid = mile.Id } + fmt.Println(mid) page, _ := base.StrTo(ctx.Query("page")).Int() diff --git a/templates/issue/milestone.tmpl b/templates/issue/milestone.tmpl index ebf02d83a..8a5751c19 100644 --- a/templates/issue/milestone.tmpl +++ b/templates/issue/milestone.tmpl @@ -19,8 +19,8 @@ {{range .Milestones}}