forked from p85947160/gitea
Work on #249 issue1
This commit is contained in:
parent
47d29a1ee0
commit
98f614a58e
|
@ -67,7 +67,7 @@ func Profile(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.Data["Title"] = "Profile"
|
ctx.Data["Title"] = "Profile"
|
||||||
ctx.Data["PageIsUserProfile"] = true
|
ctx.Data["PageIsUserProfile"] = true
|
||||||
|
|
||||||
user, err := models.GetUserByName(params["username"])
|
u, err := models.GetUserByName(params["username"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "user.Profile(GetUserByName)", err)
|
ctx.Handle(404, "user.Profile(GetUserByName)", err)
|
||||||
|
@ -76,19 +76,23 @@ func Profile(ctx *middleware.Context, params martini.Params) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["Owner"] = user
|
// For security reason, hide e-mail address for anonymous visitors.
|
||||||
|
if !ctx.IsSigned {
|
||||||
|
u.Email = ""
|
||||||
|
}
|
||||||
|
ctx.Data["Owner"] = u
|
||||||
|
|
||||||
tab := ctx.Query("tab")
|
tab := ctx.Query("tab")
|
||||||
ctx.Data["TabName"] = tab
|
ctx.Data["TabName"] = tab
|
||||||
switch tab {
|
switch tab {
|
||||||
case "activity":
|
case "activity":
|
||||||
ctx.Data["Feeds"], err = models.GetFeeds(user.Id, 0, true)
|
ctx.Data["Feeds"], err = models.GetFeeds(u.Id, 0, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "user.Profile(GetFeeds)", err)
|
ctx.Handle(500, "user.Profile(GetFeeds)", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ctx.Data["Repos"], err = models.GetRepositories(user.Id, ctx.IsSigned && ctx.User.Id == user.Id)
|
ctx.Data["Repos"], err = models.GetRepositories(u.Id, ctx.IsSigned && ctx.User.Id == u.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "user.Profile(GetRepositories)", err)
|
ctx.Handle(500, "user.Profile(GetRepositories)", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue