summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-08 20:00:07 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-08 20:00:07 -0400
commit25713ab209a22b03ebadae277d3b765a340e8e82 (patch)
tree2f1dc01faa60121ba23fda996cf89146d0cc37d5
parent914ffa496f8e8e9948ca8c5596da6b0d3c17555d (diff)
downloadgitea-25713ab209a22b03ebadae277d3b765a340e8e82.tar.gz
gitea-25713ab209a22b03ebadae277d3b765a340e8e82.zip
Fix #167
-rw-r--r--models/issue.go4
-rw-r--r--routers/repo/issue.go12
-rw-r--r--routers/user/home.go6
3 files changed, 14 insertions, 8 deletions
diff --git a/models/issue.go b/models/issue.go
index a84fb0541e..f856ca63b6 100644
--- a/models/issue.go
+++ b/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
}
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 3343800663..fc6ee9ebe6 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -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
}
}
diff --git a/routers/user/home.go b/routers/user/home.go
index 775df03752..f5130f47a8 100644
--- a/routers/user/home.go
+++ b/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 {
- ctx.Handle(500, "user.Profile", err)
+ if err == models.ErrUserNotExist {
+ ctx.Handle(404, "user.Profile", err)
+ } else {
+ ctx.Handle(500, "user.Profile", err)
+ }
return
}