fix: show membership of limited orgs

- Include organisations with visibility of limited if the visitor is signed in.
- Resolves forgejo/forgejo#8093
- Added unit test.
This commit is contained in:
Gusted 2025-06-06 19:33:26 +02:00
parent 82e4ccc223
commit b68f923592
No known key found for this signature in database
GPG key ID: FD821B732837125F
4 changed files with 29 additions and 3 deletions

View file

@ -67,6 +67,7 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) {
showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
orgs, err := db.Find[organization.Organization](ctx, organization.FindOrgOptions{
UserID: ctx.ContextUser.ID,
IncludeLimited: ctx.IsSigned,
IncludePrivate: showPrivate,
})
if err != nil {