Add auto-detect home directory

This commit is contained in:
Unknown 2014-03-28 17:34:07 -04:00
parent 9047cadcd3
commit a55941ff83
5 changed files with 25 additions and 18 deletions

View file

@ -231,6 +231,12 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return
}
content := ctx.Query("content")
if len(content) == 0 {
ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", ctx.User.Name, ctx.Repo.Repository.Name, index))
return
}
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index))
if err != nil {
if err == models.ErrIssueNotExist {
@ -241,12 +247,6 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return
}
content := ctx.Query("content")
if len(content) == 0 {
ctx.Handle(404, "issue.Comment", err)
return
}
switch params["action"] {
case "new":
if err = models.CreateComment(ctx.User.Id, issue.Id, 0, 0, content); err != nil {