This commit is contained in:
Unknown 2014-05-08 20:00:07 -04:00
parent 914ffa496f
commit 25713ab209
3 changed files with 14 additions and 8 deletions

View file

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

View file

@ -33,13 +33,11 @@ func Issues(ctx *middleware.Context) {
isShowClosed := ctx.Query("state") == "closed" isShowClosed := ctx.Query("state") == "closed"
if viewType != "all" { if viewType != "all" && !ctx.IsSigned {
if !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI)) ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login") ctx.Redirect("/user/login")
return return
} }
}
var assigneeId, posterId int64 var assigneeId, posterId int64
var filterMode int var filterMode int
@ -87,7 +85,7 @@ func Issues(ctx *middleware.Context) {
} }
if err = issues[i].GetPoster(); err != nil { 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 return
} }
} }

View file

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