mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-13 21:18:50 +00:00
fix: paginate list of repositories in a team (#12549)
Follow-up to #12103 / !12447, which added pagination for lists of team members. @mahlzahn has [noticed](https://codeberg.org/forgejo/forgejo/issues/12103#issuecomment-14454947) that the same problem applies to the list of repositories controlled by a team, so this PR adds pagination for that too. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12549 Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
parent
160377405c
commit
7eebf5642c
4 changed files with 44 additions and 3 deletions
|
|
@ -150,13 +150,19 @@ func (t *Team) IsMember(ctx context.Context, userID int64) bool {
|
|||
return isMember
|
||||
}
|
||||
|
||||
// LoadRepositories returns paginated repositories in team of organization.
|
||||
// LoadRepositories returns the repositories of the team in t.Repos.
|
||||
func (t *Team) LoadRepositories(ctx context.Context) (err error) {
|
||||
return t.LoadPaginatedRepositories(ctx, db.ListOptionsAll)
|
||||
}
|
||||
|
||||
// LoadPaginatedRepositories loads paginated repositories of the team in t.Repos.
|
||||
func (t *Team) LoadPaginatedRepositories(ctx context.Context, listOptions db.ListOptions) (err error) {
|
||||
if t.Repos != nil {
|
||||
return nil
|
||||
}
|
||||
t.Repos, err = GetTeamRepositories(ctx, &SearchTeamRepoOptions{
|
||||
TeamID: t.ID,
|
||||
ListOptions: listOptions,
|
||||
TeamID: t.ID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue