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,10 +676,6 @@ func DeleteRepository(userId, repoId int64, userName string) (err error) { sess.Rollback() return err } - if _, err = sess.Delete(&Issue{RepoId: repoId}); err != nil { - sess.Rollback() - return err - } if _, err = sess.Delete(&IssueUser{RepoId: repoId}); err != nil { sess.Rollback() return err @@ -688,6 +684,28 @@ func DeleteRepository(userId, repoId int64, userName string) (err error) { sess.Rollback() return err } + 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 + } rawSql := "UPDATE `user` SET num_repos = num_repos - 1 WHERE id = ?" if _, err = sess.Exec(rawSql, userId); err != nil { 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}}

{{.Name}}

- {{.NumClosedIssues}} - {{.NumOpenIssues}} + {{.NumOpenIssues}} + {{.NumClosedIssues}}

Edit {{if .IsClosed}}