mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
[API] add GET /orgs endpoint (#9560)
* introduce `GET /orgs` * add TEST * show also other VisibleType's * update description * refactor a lot * SearchUserOptions by default return only public
This commit is contained in:
@@ -1469,7 +1469,7 @@ type SearchUserOptions struct {
|
||||
UID int64
|
||||
OrderBy SearchOrderBy
|
||||
Page int
|
||||
Private bool // Include private orgs in search
|
||||
Visible []structs.VisibleType
|
||||
OwnerID int64 // id of user for visibility calculation
|
||||
PageSize int // Can be smaller than or equal to setting.UI.ExplorePagingNum
|
||||
IsActive util.OptionalBool
|
||||
@@ -1492,8 +1492,9 @@ func (opts *SearchUserOptions) toConds() builder.Cond {
|
||||
cond = cond.And(keywordCond)
|
||||
}
|
||||
|
||||
if !opts.Private {
|
||||
// user not logged in and so they won't be allowed to see non-public orgs
|
||||
if len(opts.Visible) > 0 {
|
||||
cond = cond.And(builder.In("visibility", opts.Visible))
|
||||
} else {
|
||||
cond = cond.And(builder.In("visibility", structs.VisibleTypePublic))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user