summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-07-05 16:47:45 +0100
committerGitHub <noreply@github.com>2022-07-05 16:47:45 +0100
commit45f17528a856718457b79011cfd20c127ee87452 (patch)
tree16c1feca3c428274d74c57ff5aa505d6d874ea74 /routers/api/v1/user
parented13d7aadf75246a3b9ba68c5cd2def867f89f43 (diff)
downloadgitea-45f17528a856718457b79011cfd20c127ee87452.tar.gz
gitea-45f17528a856718457b79011cfd20c127ee87452.zip
Only show Followers that current user can access (#20220)
Users who are following or being followed by a user should only be displayed if the viewing user can see them. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r--routers/api/v1/user/follower.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index 3c81b27f8d..22f8f40e1c 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -24,13 +24,13 @@ func responseAPIUsers(ctx *context.APIContext, users []*user_model.User) {
}
func listUserFollowers(ctx *context.APIContext, u *user_model.User) {
- users, err := user_model.GetUserFollowers(u, utils.GetListOptions(ctx))
+ users, count, err := user_model.GetUserFollowers(ctx, u, ctx.Doer, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserFollowers", err)
return
}
- ctx.SetTotalCountHeader(int64(u.NumFollowers))
+ ctx.SetTotalCountHeader(count)
responseAPIUsers(ctx, users)
}
@@ -86,13 +86,13 @@ func ListFollowers(ctx *context.APIContext) {
}
func listUserFollowing(ctx *context.APIContext, u *user_model.User) {
- users, err := user_model.GetUserFollowing(u, utils.GetListOptions(ctx))
+ users, count, err := user_model.GetUserFollowing(ctx, u, ctx.Doer, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserFollowing", err)
return
}
- ctx.SetTotalCountHeader(int64(u.NumFollowing))
+ ctx.SetTotalCountHeader(count)
responseAPIUsers(ctx, users)
}