mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 20:59:31 +01:00
Fix #167
This commit is contained in:
parent
914ffa496f
commit
25713ab209
3 changed files with 14 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,10 @@ func Issues(ctx *middleware.Context) {
|
|||
|
||||
isShowClosed := ctx.Query("state") == "closed"
|
||||
|
||||
if viewType != "all" {
|
||||
if !ctx.IsSigned {
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
|
||||
ctx.Redirect("/user/login")
|
||||
return
|
||||
}
|
||||
if viewType != "all" && !ctx.IsSigned {
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
|
||||
ctx.Redirect("/user/login")
|
||||
return
|
||||
}
|
||||
|
||||
var assigneeId, posterId int64
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,11 @@ func Profile(ctx *middleware.Context, params martini.Params) {
|
|||
|
||||
user, err := models.GetUserByName(params["username"])
|
||||
if err != nil {
|
||||
ctx.Handle(500, "user.Profile", err)
|
||||
if err == models.ErrUserNotExist {
|
||||
ctx.Handle(404, "user.Profile", err)
|
||||
} else {
|
||||
ctx.Handle(500, "user.Profile", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue