1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-26 09:09:36 -05:00

Fix when private user following user, private user will not be counted in his own view (#28037) (#28792)

Backport #28037 by @yp05327

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)

Co-authored-by: yp05327 <576951401@qq.com>
This commit is contained in:
Giteabot 2024-01-15 15:07:10 +08:00 committed by GitHub
parent d1db2b7251
commit 84282c608c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1205,6 +1205,8 @@ func isUserVisibleToViewerCond(viewer *User) builder.Cond {
return builder.Neq{ return builder.Neq{
"`user`.visibility": structs.VisibleTypePrivate, "`user`.visibility": structs.VisibleTypePrivate,
}.Or( }.Or(
// viewer self
builder.Eq{"`user`.id": viewer.ID},
// viewer's following // viewer's following
builder.In("`user`.id", builder.In("`user`.id",
builder. builder.