aboutsummaryrefslogtreecommitdiffstats
path: root/models/user/user.go
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2024-01-15 14:43:14 +0900
committerGitHub <noreply@github.com>2024-01-15 05:43:14 +0000
commitb820019fec1bd955b6cb9dba1ce2f2571924ae64 (patch)
tree3fead8192ac9e2f0565fd48ecb689f483372167b /models/user/user.go
parentfee80a1847e6fb81e8e9796768abac6fbba2a064 (diff)
downloadgitea-b820019fec1bd955b6cb9dba1ce2f2571924ae64.tar.gz
gitea-b820019fec1bd955b6cb9dba1ce2f2571924ae64.zip
Fix when private user following user, private user will not be counted in his own view (#28037)
Doer: asdasasdasasdasasdasasdasasdasasdasasdas (private user) Followed: TestUser (public user) Before: (From doer's view) ![image](https://github.com/go-gitea/gitea/assets/18380374/9ba16b3b-068c-43c5-a3dd-e3343b5b32f2) (From followed user's view, can see doer) ![image](https://github.com/go-gitea/gitea/assets/18380374/dfd1b564-d689-4393-b3d3-1e6bf52c94ba) After: (From doer's view) ![image](https://github.com/go-gitea/gitea/assets/18380374/1c85c1d1-c9f7-40c8-948c-145f7cae9a04)
Diffstat (limited to 'models/user/user.go')
-rw-r--r--models/user/user.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go
index d828f3d65d..204c8f41b6 100644
--- a/models/user/user.go
+++ b/models/user/user.go
@@ -1230,6 +1230,8 @@ func isUserVisibleToViewerCond(viewer *User) builder.Cond {
return builder.Neq{
"`user`.visibility": structs.VisibleTypePrivate,
}.Or(
+ // viewer self
+ builder.Eq{"`user`.id": viewer.ID},
// viewer's following
builder.In("`user`.id",
builder.