diff options
author | Yarden Shoham <git@yardenshoham.com> | 2023-05-17 02:12:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 02:12:37 +0200 |
commit | 0a3c4d4a595cc7e12462dde393ed64186260f26b (patch) | |
tree | 5c98ba3ef7b0b85e3ba2af61e7b33ae27d9b9261 /models/organization | |
parent | Make mailer SMTP check have timed context (#24751) (diff) | |
download | forgejo-0a3c4d4a595cc7e12462dde393ed64186260f26b.tar.xz forgejo-0a3c4d4a595cc7e12462dde393ed64186260f26b.zip |
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)
## :warning: BREAKING :warning:
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 <git@yardenshoham.com>
Diffstat (limited to 'models/organization')
-rw-r--r-- | models/organization/team_user.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/organization/team_user.go b/models/organization/team_user.go index 816daf3d34..768dc24c50 100644 --- a/models/organization/team_user.go +++ b/models/organization/team_user.go @@ -63,8 +63,8 @@ func GetTeamMembers(ctx context.Context, opts *SearchMembersOptions) ([]*user_mo Where(builder.Eq{"team_id": opts.TeamID}), ) } - if opts.PageSize > 0 && opts.Page > -1 { - sess = sess.Limit(opts.PageSize, opts.Page*opts.PageSize) + if opts.PageSize > 0 && opts.Page > 0 { + sess = sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) } if err := sess.OrderBy("full_name, name").Find(&members); err != nil { return nil, err |