mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 07:43:18 -05:00
Fix page and missing return on unadopted repos API (#18848)
* Fix page and missing return on unadopted repos API Page must be 1 if it's not specified and it should return after sending an internal server error. * Allow ignore pages Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
3ba9dcf4b4
commit
1563a45623
3 changed files with 4 additions and 2 deletions
|
@ -468,7 +468,6 @@ func TestAPIRepoTransfer(t *testing.T) {
|
||||||
expectedStatus int
|
expectedStatus int
|
||||||
}{
|
}{
|
||||||
// Disclaimer for test story: "user1" is an admin, "user2" is normal user and part of in owner team of org "user3"
|
// Disclaimer for test story: "user1" is an admin, "user2" is normal user and part of in owner team of org "user3"
|
||||||
|
|
||||||
// Transfer to a user with teams in another org should fail
|
// Transfer to a user with teams in another org should fail
|
||||||
{ctxUserID: 1, newOwner: "user3", teams: &[]int64{5}, expectedStatus: http.StatusForbidden},
|
{ctxUserID: 1, newOwner: "user3", teams: &[]int64{5}, expectedStatus: http.StatusForbidden},
|
||||||
// Transfer to a user with non-existent team IDs should fail
|
// Transfer to a user with non-existent team IDs should fail
|
||||||
|
|
|
@ -61,7 +61,6 @@ type Version struct {
|
||||||
// update minDBVersion accordingly
|
// update minDBVersion accordingly
|
||||||
var migrations = []Migration{
|
var migrations = []Migration{
|
||||||
// Gitea 1.5.0 ends at v69
|
// Gitea 1.5.0 ends at v69
|
||||||
|
|
||||||
// v70 -> v71
|
// v70 -> v71
|
||||||
NewMigration("add issue_dependencies", addIssueDependencies),
|
NewMigration("add issue_dependencies", addIssueDependencies),
|
||||||
// v71 -> v72
|
// v71 -> v72
|
||||||
|
|
|
@ -43,9 +43,13 @@ func ListUnadoptedRepositories(ctx *context.APIContext) {
|
||||||
// "$ref": "#/responses/forbidden"
|
// "$ref": "#/responses/forbidden"
|
||||||
|
|
||||||
listOptions := utils.GetListOptions(ctx)
|
listOptions := utils.GetListOptions(ctx)
|
||||||
|
if listOptions.Page == 0 {
|
||||||
|
listOptions.Page = 1
|
||||||
|
}
|
||||||
repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx.FormString("query"), &listOptions)
|
repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx.FormString("query"), &listOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.InternalServerError(err)
|
ctx.InternalServerError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetTotalCountHeader(int64(count))
|
ctx.SetTotalCountHeader(int64(count))
|
||||||
|
|
Loading…
Reference in a new issue