mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-04 01:14:36 -04:00
Rework api/user/repos for pagination (#11827)
* Add count to `GetUserRepositories` so that pagination can be supported for `/user/{username}/repos` * Rework ListMyRepos to use models.SearchRepository ListMyRepos was an odd one. It first fetched all user repositories and then tried to supplement them with accessible map. The end result was that: * Limit for pagination did not work because accessible repos would always be appended * The amount of pages was incorrect if one were to calculate it * When paginating, all accessible repos would be shown on every page Hopefully it should now work properly. Fixes #11800 and does not require any change on Drone-side as it can properly interpret and act on Link header which we now set. Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
2447ffc74a
commit
0159851cc3
3 changed files with 48 additions and 29 deletions
|
@ -646,7 +646,7 @@ func (u *User) GetOrganizationCount() (int64, error) {
|
|||
|
||||
// GetRepositories returns repositories that user owns, including private repositories.
|
||||
func (u *User) GetRepositories(listOpts ListOptions) (err error) {
|
||||
u.Repos, err = GetUserRepositories(&SearchRepoOptions{Actor: u, Private: true, ListOptions: listOpts})
|
||||
u.Repos, _, err = GetUserRepositories(&SearchRepoOptions{Actor: u, Private: true, ListOptions: listOpts})
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue