Hide limited users if viewed by anonymous ghost (#25214) (#25224)

Backport #25214 by @KN4CK3R

The ghost user leads to inclusion of limited users/orgs in
`BuildCanSeeUserCondition`.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit a9ebf911faefb286d25c3731668740e0b2ed1904)
This commit is contained in:
Giteabot 2023-06-13 03:26:47 -04:00 committed by Earl Warren
parent a87c620d99
commit 38e5589bd6
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -271,6 +271,10 @@ func GetRepositories(ctx context.Context, actor *user_model.User, n int, last st
cond = cond.And(builder.Gt{"package_property.value": strings.ToLower(last)})
}
if actor.IsGhost() {
actor = nil
}
cond = cond.And(user_model.BuildCanSeeUserCondition(actor))
sess := db.GetEngine(ctx).