Skip to content

Commit

Permalink
fix: User can see the private activity on public activity history. (#818
Browse files Browse the repository at this point in the history
)
  • Loading branch information
appleboy authored and lunny committed Feb 2, 2017
1 parent ea8c8cd commit 2db0ffe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions routers/user/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ func Profile(ctx *context.Context) {
ctx.Data["Title"] = ctxUser.DisplayName()
ctx.Data["PageIsUserProfile"] = true
ctx.Data["Owner"] = ctxUser
showPrivate := ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)

orgs, err := models.GetOrgsByUserID(ctxUser.ID, ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID))
orgs, err := models.GetOrgsByUserID(ctxUser.ID, showPrivate)
if err != nil {
ctx.Handle(500, "GetOrgsByUserIDDesc", err)
return
Expand All @@ -91,13 +92,12 @@ func Profile(ctx *context.Context) {
ctx.Data["TabName"] = tab
switch tab {
case "activity":
retrieveFeeds(ctx, ctxUser, -1, 0, true)
retrieveFeeds(ctx, ctxUser, -1, 0, !showPrivate)
if ctx.Written() {
return
}
case "stars":
showPrivateRepos := ctx.IsSigned && ctx.User.ID == ctxUser.ID
starredRepos, err := ctxUser.GetStarredRepos(showPrivateRepos)
starredRepos, err := ctxUser.GetStarredRepos(showPrivate)
if err != nil {
ctx.Handle(500, "GetStarredRepos", err)
return
Expand All @@ -109,7 +109,7 @@ func Profile(ctx *context.Context) {
page = 1
}

ctx.Data["Repos"], err = models.GetUserRepositories(ctxUser.ID, ctx.IsSigned && ctx.User.ID == ctxUser.ID, page, setting.UI.User.RepoPagingNum)
ctx.Data["Repos"], err = models.GetUserRepositories(ctxUser.ID, showPrivate, page, setting.UI.User.RepoPagingNum)
if err != nil {
ctx.Handle(500, "GetRepositories", err)
return
Expand Down

0 comments on commit 2db0ffe

Please sign in to comment.