mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-23 09:30:50 +00:00
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:
parent
82e4ccc223
commit
b68f923592
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