From b9928588834a9aad1771ba79f1d6638cdc29904a Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 29 Dec 2016 12:58:24 -0200 Subject: Tab on user profile to show starred repos (#519) * Tab on user profile to show starred repos * Make golint happy and use transactions on StarRepo function * x -> sess * Use sess.Close() instead of sess.Rollback() * Add copyright * Fix lint --- routers/user/profile.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'routers/user/profile.go') diff --git a/routers/user/profile.go b/routers/user/profile.go index a5f4a97efd..f72ced7b3c 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -95,6 +95,14 @@ func Profile(ctx *context.Context) { if ctx.Written() { return } + case "stars": + showPrivateRepos := ctx.IsSigned && ctx.User.ID == ctxUser.ID + starredRepos, err := ctxUser.GetStarredRepos(showPrivateRepos) + if err != nil { + ctx.Handle(500, "GetStarredRepos", err) + return + } + ctx.Data["Repos"] = starredRepos default: page := ctx.QueryInt("page") if page <= 0 { @@ -138,11 +146,6 @@ func Following(ctx *context.Context) { 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) -- cgit v1.2.3