Fix listing Gitea repos (#2768)

This commit is contained in:
Patrick Schratz 2023-11-07 20:18:42 +01:00 committed by GitHub
parent 52163b9a3e
commit 9d5ef117a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -259,7 +259,7 @@ func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)
return nil, err return nil, err
} }
return shared_utils.Paginate(func(page int) ([]*model.Repo, error) { repos, err := shared_utils.Paginate(func(page int) ([]*gitea.Repository, error) {
repos, _, err := client.ListMyRepos( repos, _, err := client.ListMyRepos(
gitea.ListReposOptions{ gitea.ListReposOptions{
ListOptions: gitea.ListOptions{ ListOptions: gitea.ListOptions{
@ -268,6 +268,9 @@ func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)
}, },
}, },
) )
return repos, err
})
result := make([]*model.Repo, 0, len(repos)) result := make([]*model.Repo, 0, len(repos))
for _, repo := range repos { for _, repo := range repos {
if repo.Archived { if repo.Archived {
@ -276,7 +279,6 @@ func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)
result = append(result, toRepo(repo)) result = append(result, toRepo(repo))
} }
return result, err return result, err
})
} }
// File fetches the file from the Gitea repository and returns its contents. // File fetches the file from the Gitea repository and returns its contents.