88
99	"code.gitea.io/gitea/models/db" 
1010	project_model "code.gitea.io/gitea/models/project" 
11- 	"code.gitea.io/gitea/modules/setting" 
1211	api "code.gitea.io/gitea/modules/structs" 
1312	"code.gitea.io/gitea/modules/web" 
13+ 	"code.gitea.io/gitea/routers/api/v1/utils" 
1414	"code.gitea.io/gitea/services/context" 
1515	"code.gitea.io/gitea/services/convert" 
1616)
@@ -283,18 +283,20 @@ func ListUserProjects(ctx *context.APIContext) {
283283	//    "$ref": "#/responses/forbidden" 
284284	//  "404": 
285285	//    "$ref": "#/responses/notFound" 
286+ 
287+ 	listOptions  :=  utils .GetListOptions (ctx )
286288	projects , count , err  :=  db .FindAndCount [project_model.Project ](ctx , project_model.SearchOptions {
287289		Type :        project_model .TypeIndividual ,
288290		IsClosed :    ctx .FormOptionalBool ("closed" ),
289291		OwnerID :     ctx .Doer .ID ,
290- 		ListOptions : db. ListOptions { Page :  ctx . FormInt ( "page" )} ,
292+ 		ListOptions : listOptions ,
291293	})
292294	if  err  !=  nil  {
293295		ctx .APIErrorInternal (err )
294296		return 
295297	}
296298
297- 	ctx .SetLinkHeader (int (count ), setting . UI . IssuePagingNum )
299+ 	ctx .SetLinkHeader (int (count ), listOptions . PageSize )
298300	ctx .SetTotalCountHeader (count )
299301
300302	apiProjects , err  :=  convert .ToAPIProjectList (ctx , projects )
@@ -337,9 +339,11 @@ func ListOrgProjects(ctx *context.APIContext) {
337339	//    "$ref": "#/responses/forbidden" 
338340	//  "404": 
339341	//    "$ref": "#/responses/notFound" 
342+ 
343+ 	listOptions  :=  utils .GetListOptions (ctx )
340344	projects , count , err  :=  db .FindAndCount [project_model.Project ](ctx , project_model.SearchOptions {
341345		OwnerID :     ctx .Org .Organization .AsUser ().ID ,
342- 		ListOptions : db. ListOptions { Page :  ctx . FormInt ( "page" )} ,
346+ 		ListOptions : listOptions ,
343347		IsClosed :    ctx .FormOptionalBool ("closed" ),
344348		Type :        project_model .TypeOrganization ,
345349	})
@@ -348,7 +352,7 @@ func ListOrgProjects(ctx *context.APIContext) {
348352		return 
349353	}
350354
351- 	ctx .SetLinkHeader (int (count ), setting . UI . IssuePagingNum )
355+ 	ctx .SetLinkHeader (int (count ), listOptions . PageSize )
352356	ctx .SetTotalCountHeader (count )
353357
354358	apiProjects , err  :=  convert .ToAPIProjectList (ctx , projects )
@@ -397,19 +401,19 @@ func ListRepoProjects(ctx *context.APIContext) {
397401	//  "404": 
398402	//    "$ref": "#/responses/notFound" 
399403
400- 	page  :=  ctx . FormInt ( "page" )
404+ 	listOptions  :=  utils . GetListOptions ( ctx )
401405	projects , count , err  :=  db .FindAndCount [project_model.Project ](ctx , project_model.SearchOptions {
402406		RepoID :      ctx .Repo .Repository .ID ,
403407		IsClosed :    ctx .FormOptionalBool ("closed" ),
404408		Type :        project_model .TypeRepository ,
405- 		ListOptions : db. ListOptions { Page :  page } ,
409+ 		ListOptions : listOptions ,
406410	})
407411	if  err  !=  nil  {
408412		ctx .APIErrorInternal (err )
409413		return 
410414	}
411415
412- 	ctx .SetLinkHeader (int (count ), page )
416+ 	ctx .SetLinkHeader (int (count ), listOptions . PageSize )
413417	ctx .SetTotalCountHeader (count )
414418
415419	apiProjects , err  :=  convert .ToAPIProjectList (ctx , projects )
0 commit comments