diff options
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 9688fd4d94..9ab07c0d59 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -82,15 +82,17 @@ func Issues(ctx *middleware.Context) { ctx.HTML(200, "issue/list") } -func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { +func CreateIssue(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Create issue" ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = false + ctx.HTML(200, "issue/create") +} - if ctx.Req.Method == "GET" { - ctx.HTML(200, "issue/create") - return - } +func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { + ctx.Data["Title"] = "Create issue" + ctx.Data["IsRepoToolbarIssues"] = true + ctx.Data["IsRepoToolbarIssuesList"] = false if ctx.HasError() { ctx.HTML(200, "issue/create") @@ -100,7 +102,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat issue, err := models.CreateIssue(ctx.User.Id, ctx.Repo.Repository.Id, form.MilestoneId, form.AssigneeId, ctx.Repo.Repository.NumIssues, form.IssueName, form.Labels, form.Content, false) if err != nil { - ctx.Handle(200, "issue.CreateIssue(CreateIssue)", err) + ctx.Handle(500, "issue.CreateIssue(CreateIssue)", err) return } @@ -108,7 +110,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat if err = models.NotifyWatchers(&models.Action{ActUserId: ctx.User.Id, ActUserName: ctx.User.Name, ActEmail: ctx.User.Email, OpType: models.OP_CREATE_ISSUE, Content: fmt.Sprintf("%d|%s", issue.Index, issue.Name), RepoId: ctx.Repo.Repository.Id, RepoName: ctx.Repo.Repository.Name, RefName: ""}); err != nil { - ctx.Handle(200, "issue.CreateIssue(NotifyWatchers)", err) + ctx.Handle(500, "issue.CreateIssue(NotifyWatchers)", err) return } @@ -116,7 +118,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat if base.Service.NotifyMail { tos, err := mailer.SendIssueNotifyMail(ctx.User, ctx.Repo.Owner, ctx.Repo.Repository, issue) if err != nil { - ctx.Handle(200, "issue.CreateIssue(SendIssueNotifyMail)", err) + ctx.Handle(500, "issue.CreateIssue(SendIssueNotifyMail)", err) return } @@ -132,12 +134,12 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat } if err = mailer.SendIssueMentionMail(ctx.User, ctx.Repo.Owner, ctx.Repo.Repository, issue, models.GetUserEmailsByNames(newTos)); err != nil { - ctx.Handle(200, "issue.CreateIssue(SendIssueMentionMail)", err) + ctx.Handle(500, "issue.CreateIssue(SendIssueMentionMail)", err) return } } - log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id) + ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", params["username"], params["reponame"], issue.Index)) } |