diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-18 11:03:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-18 11:03:03 +0800 |
commit | cf045b029cc11dc48c3a626441b7017710088823 (patch) | |
tree | f234f8ad8b8a548bda4c9d372ca5b9af95b0b40b /routers/user/profile.go | |
parent | 91953ae9b421300eef79d58891dec7f2026e5d53 (diff) | |
download | gitea-cf045b029cc11dc48c3a626441b7017710088823.tar.gz gitea-cf045b029cc11dc48c3a626441b7017710088823.zip |
golint fixed for parts of routers root, dev, user and org dirs (#167)
* golint fixed for parts of routers root, dev and org dirs
* add user/auth.go golint fixed
* rename unnecessary exported to unexported and user dir golint fixed
Diffstat (limited to 'routers/user/profile.go')
-rw-r--r-- | routers/user/profile.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go index fc8ef442ba..a5f4a97efd 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -19,10 +19,11 @@ import ( ) const ( - FOLLOWERS base.TplName = "user/meta/followers" - STARS base.TplName = "user/meta/stars" + tplFollowers base.TplName = "user/meta/followers" + tplStars base.TplName = "user/meta/stars" ) +// GetUserByName get user by name func GetUserByName(ctx *context.Context, name string) *models.User { user, err := models.GetUserByName(name) if err != nil { @@ -41,6 +42,7 @@ func GetUserByParams(ctx *context.Context) *models.User { return GetUserByName(ctx, ctx.Params(":username")) } +// Profile render user's profile page func Profile(ctx *context.Context) { uname := ctx.Params(":username") // Special handle for FireFox requests favicon.ico. @@ -107,9 +109,10 @@ func Profile(ctx *context.Context) { ctx.Data["Page"] = paginater.New(ctxUser.NumRepos, setting.UI.User.RepoPagingNum, page, 5) } - ctx.HTML(200, PROFILE) + ctx.HTML(200, tplProfile) } +// Followers render user's followers page func Followers(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { @@ -119,9 +122,10 @@ func Followers(ctx *context.Context) { ctx.Data["CardsTitle"] = ctx.Tr("user.followers") ctx.Data["PageIsFollowers"] = true ctx.Data["Owner"] = u - repo.RenderUserCards(ctx, u.NumFollowers, u.GetFollowers, FOLLOWERS) + repo.RenderUserCards(ctx, u.NumFollowers, u.GetFollowers, tplFollowers) } +// Following render user's followering page func Following(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { @@ -131,13 +135,15 @@ func Following(ctx *context.Context) { ctx.Data["CardsTitle"] = ctx.Tr("user.following") ctx.Data["PageIsFollowing"] = true ctx.Data["Owner"] = u - repo.RenderUserCards(ctx, u.NumFollowing, u.GetFollowing, FOLLOWERS) + repo.RenderUserCards(ctx, u.NumFollowing, u.GetFollowing, tplFollowers) } +// Stars show repositories user starred func Stars(ctx *context.Context) { } +// Action response for follow/unfollow user request func Action(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { |