Browse Source

Fix #167

pull/168/head
Unknown 11 years ago
parent
commit
25713ab209
  1. 4
      models/issue.go
  2. 6
      routers/repo/issue.go
  3. 4
      routers/user/home.go

4
models/issue.go

@ -44,6 +44,10 @@ type Issue struct {
func (i *Issue) GetPoster() (err error) {
i.Poster, err = GetUserById(i.PosterId)
if err == ErrUserNotExist {
i.Poster = &User{Name: "FakeUser"}
return nil
}
return err
}

6
routers/repo/issue.go

@ -33,13 +33,11 @@ func Issues(ctx *middleware.Context) {
isShowClosed := ctx.Query("state") == "closed"
if viewType != "all" {
if !ctx.IsSigned {
if viewType != "all" && !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login")
return
}
}
var assigneeId, posterId int64
var filterMode int
@ -87,7 +85,7 @@ func Issues(ctx *middleware.Context) {
}
if err = issues[i].GetPoster(); err != nil {
ctx.Handle(500, "issue.Issues(GetPoster): %v", err)
ctx.Handle(500, "issue.Issues(GetPoster)", fmt.Errorf("[#%d]%v", issues[i].Id, err))
return
}
}

4
routers/user/home.go

@ -53,7 +53,11 @@ func Profile(ctx *middleware.Context, params martini.Params) {
user, err := models.GetUserByName(params["username"])
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "user.Profile", err)
} else {
ctx.Handle(500, "user.Profile", err)
}
return
}

Loading…
Cancel
Save