Skip to content

Commit 0a3c4d4

Browse files
authored
Fix team members API endpoint pagination (#24754)
Now it's 1-based instead of 0-based - Fixes #24747 ### Before ![image](https://github.com/go-gitea/gitea/assets/20454870/9b58ecfa-666c-4b78-bd0f-93233efeecbd) ### After ![image](https://github.com/go-gitea/gitea/assets/20454870/103b767a-e02e-4473-9f9f-5a676a61c174) ## ⚠️ BREAKING ⚠️ Previous API consumers may have relied on the 0-based pagination of this endpoint. The page numbering now starts at 1, as documented. Signed-off-by: Yarden Shoham <[email protected]>
1 parent 584c078 commit 0a3c4d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/organization/team_user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ func GetTeamMembers(ctx context.Context, opts *SearchMembersOptions) ([]*user_mo
6363
Where(builder.Eq{"team_id": opts.TeamID}),
6464
)
6565
}
66-
if opts.PageSize > 0 && opts.Page > -1 {
67-
sess = sess.Limit(opts.PageSize, opts.Page*opts.PageSize)
66+
if opts.PageSize > 0 && opts.Page > 0 {
67+
sess = sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
6868
}
6969
if err := sess.OrderBy("full_name, name").Find(&members); err != nil {
7070
return nil, err

0 commit comments

Comments
 (0)