This commit is contained in:
Unknown 2014-05-14 13:04:57 -04:00
parent 16bddd593a
commit b70db61854
4 changed files with 27 additions and 6 deletions

View File

@ -167,6 +167,8 @@ type IssueUser struct {
Uid int64 // User ID. Uid int64 // User ID.
IssueId int64 IssueId int64
RepoId int64 RepoId int64
MilestoneId int64
Labels string `xorm:"TEXT"`
IsRead bool IsRead bool
IsAssigned bool IsAssigned bool
IsMentioned bool IsMentioned bool

View File

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

View File

@ -63,6 +63,7 @@ func Issues(ctx *middleware.Context) {
} }
mid = mile.Id mid = mile.Id
} }
fmt.Println(mid)
page, _ := base.StrTo(ctx.Query("page")).Int() page, _ := base.StrTo(ctx.Query("page")).Int()

View File

@ -19,8 +19,8 @@
{{range .Milestones}} {{range .Milestones}}
<div class="list-group-item milestone-item"> <div class="list-group-item milestone-item">
<h4 class="title pull-left"><a href="{{$.RepoLink}}/issues?milestone={{.Index}}{{if .IsClosed}}&state=closed{{end}}">{{.Name}}</a></h4> <h4 class="title pull-left"><a href="{{$.RepoLink}}/issues?milestone={{.Index}}{{if .IsClosed}}&state=closed{{end}}">{{.Name}}</a></h4>
<span class="issue-open label label-success">{{.NumClosedIssues}}</span> <span class="issue-open label label-success">{{.NumOpenIssues}}</span>
<span class="issue-close label label-warning">{{.NumOpenIssues}}</span> <span class="issue-close label label-warning">{{.NumClosedIssues}}</span>
<p class="actions pull-right"> <p class="actions pull-right">
<a href="{{$.RepoLink}}/issues/milestones/{{.Index}}/edit">Edit</a> <a href="{{$.RepoLink}}/issues/milestones/{{.Index}}/edit">Edit</a>
{{if .IsClosed}} {{if .IsClosed}}