mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-10 19:32:02 +00:00
[v11.0/forgejo] fix: show membership of limited orgs (#8095)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8094 - Include organisations with visibility of limited if the visitor is signed in. - Resolves forgejo/forgejo#8093 - Added unit test. Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8095 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
d3c6ab538e
commit
f067db8f8e
4 changed files with 29 additions and 3 deletions
|
|
@ -26,6 +26,7 @@ type SearchOrganizationsOptions struct {
|
|||
type FindOrgOptions struct {
|
||||
db.ListOptions
|
||||
UserID int64
|
||||
IncludeLimited bool
|
||||
IncludePrivate bool
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +44,11 @@ func (opts FindOrgOptions) ToConds() builder.Cond {
|
|||
cond = cond.And(builder.In("`user`.`id`", queryUserOrgIDs(opts.UserID, opts.IncludePrivate)))
|
||||
}
|
||||
if !opts.IncludePrivate {
|
||||
cond = cond.And(builder.Eq{"`user`.visibility": structs.VisibleTypePublic})
|
||||
if !opts.IncludeLimited {
|
||||
cond = cond.And(builder.Eq{"`user`.visibility": structs.VisibleTypePublic})
|
||||
} else {
|
||||
cond = cond.And(builder.In("`user`.visibility", structs.VisibleTypePublic, structs.VisibleTypeLimited))
|
||||
}
|
||||
}
|
||||
return cond
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue