aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/issue.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r--routers/repo/issue.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 23571e759b..ba0669a0ad 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -18,6 +18,10 @@ import (
)
func Issues(ctx *middleware.Context) {
+ if !ctx.Repo.IsValid {
+ ctx.Handle(404, "issue.Issues(invalid repo):", nil)
+ }
+
ctx.Data["Title"] = "Issues"
ctx.Data["IsRepoToolbarIssues"] = true
ctx.Data["IsRepoToolbarIssuesList"] = true
@@ -26,12 +30,17 @@ func Issues(ctx *middleware.Context) {
milestoneId, _ := base.StrTo(ctx.Query("milestone")).Int()
page, _ := base.StrTo(ctx.Query("page")).Int()
+ ctx.Data["IssueCreatedCount"] = 0
+
var posterId int64 = 0
if ctx.Query("type") == "created_by" {
+ if !ctx.IsSigned {
+ ctx.Redirect("/user/login/", 302)
+ }
posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by"
+ ctx.Data["IssueCreatedCount"] = models.GetUserIssueCount(posterId, ctx.Repo.Repository.Id)
}
- ctx.Data["IssueCreatedCount"] = models.GetUserIssueCount(ctx.User.Id, ctx.Repo.Repository.Id)
// Get issues.
issues, err := models.GetIssues(0, ctx.Repo.Repository.Id, posterId, int64(milestoneId), page,
@@ -60,6 +69,10 @@ func Issues(ctx *middleware.Context) {
}
func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) {
+ if !ctx.Repo.IsValid {
+ ctx.Handle(404, "issue.CreateIssue(invalid repo):", nil)
+ }
+
ctx.Data["Title"] = "Create issue"
ctx.Data["IsRepoToolbarIssues"] = true
ctx.Data["IsRepoToolbarIssuesList"] = false
@@ -102,6 +115,10 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat
}
func ViewIssue(ctx *middleware.Context, params martini.Params) {
+ if !ctx.Repo.IsValid {
+ ctx.Handle(404, "issue.ViewIssue(invalid repo):", nil)
+ }
+
index, err := base.StrTo(params["index"]).Int()
if err != nil {
ctx.Handle(404, "issue.ViewIssue", err)
@@ -154,6 +171,10 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) {
}
func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) {
+ if !ctx.Repo.IsValid {
+ ctx.Handle(404, "issue.UpdateIssue(invalid repo):", nil)
+ }
+
index, err := base.StrTo(params["index"]).Int()
if err != nil {
ctx.Handle(404, "issue.UpdateIssue", err)
@@ -190,6 +211,10 @@ func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat
}
func Comment(ctx *middleware.Context, params martini.Params) {
+ if !ctx.Repo.IsValid {
+ ctx.Handle(404, "issue.Comment(invalid repo):", nil)
+ }
+
index, err := base.StrTo(ctx.Query("issueIndex")).Int()
if err != nil {
ctx.Handle(404, "issue.Comment", err)