This commit is contained in:
Unknown 2014-03-28 09:16:12 -04:00
parent 76b8642348
commit 63dae435f9
1 changed files with 9 additions and 2 deletions

View File

@ -40,9 +40,7 @@ func Issues(ctx *middleware.Context) {
ctx.Redirect("/user/login/", 302) ctx.Redirect("/user/login/", 302)
return return
} }
posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by" ctx.Data["ViewType"] = "created_by"
ctx.Data["IssueCreatedCount"] = models.GetUserIssueCount(posterId, ctx.Repo.Repository.Id)
} }
// Get issues. // Get issues.
@ -53,6 +51,11 @@ func Issues(ctx *middleware.Context) {
return return
} }
if ctx.IsSigned {
posterId = ctx.User.Id
}
var createdByCount int
// Get posters. // Get posters.
for i := range issues { for i := range issues {
u, err := models.GetUserById(issues[i].PosterId) u, err := models.GetUserById(issues[i].PosterId)
@ -61,12 +64,16 @@ func Issues(ctx *middleware.Context) {
return return
} }
issues[i].Poster = u issues[i].Poster = u
if u.Id == posterId {
createdByCount++
}
} }
ctx.Data["Issues"] = issues ctx.Data["Issues"] = issues
ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues
ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues
ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues
ctx.Data["IssueCreatedCount"] = createdByCount
ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed" ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed"
ctx.HTML(200, "issue/list") ctx.HTML(200, "issue/list")
} }