Skip to content

Commit

Permalink
Fix when private user following user, private user will not be counte…
Browse files Browse the repository at this point in the history
…d 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)
  • Loading branch information
yp05327 authored Jan 15, 2024
1 parent fee80a1 commit b820019
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b820019

Please sign in to comment.