mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-31 12:00:01 +02:00
HotFix: Hide private partisipation in Orgs (#13994)
* HotFix: Hide private partisipation in Orgs * refactor & add node to fuc GetOrganizations
This commit is contained in:
parent
069acf6a21
commit
9e456b5a56
3 changed files with 40 additions and 11 deletions
|
@ -66,3 +66,22 @@ func GetListOptions(ctx *context.APIContext) models.ListOptions {
|
|||
PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")),
|
||||
}
|
||||
}
|
||||
|
||||
// PaginateUserSlice cut a slice of Users as per pagination options
|
||||
// TODO: make it generic
|
||||
func PaginateUserSlice(items []*models.User, page, pageSize int) []*models.User {
|
||||
if page != 0 {
|
||||
page--
|
||||
}
|
||||
|
||||
if page*pageSize >= len(items) {
|
||||
return items[len(items):]
|
||||
}
|
||||
|
||||
items = items[page*pageSize:]
|
||||
|
||||
if len(items) > pageSize {
|
||||
return items[:pageSize]
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue