summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2017-02-02 20:32:40 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-02 20:32:40 +0800
commit2db0ffe69ef80def358b96ff2c3804c79c9174c3 (patch)
treef14c0d3c75edf7fe3b784bcd9eebdfc71c75c3f8 /routers
parentea8c8cdaf358a3cc96fbf749d50a9b15a6f3ca41 (diff)
downloadgitea-2db0ffe69ef80def358b96ff2c3804c79c9174c3.tar.gz
gitea-2db0ffe69ef80def358b96ff2c3804c79c9174c3.zip
fix: User can see the private activity on public activity history. (#818)
Diffstat (limited to 'routers')
-rw-r--r--routers/user/profile.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go
index f72ced7b3c..857b9e3f5b 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -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
@@ -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
@@ -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