You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/services
qwerty287 9d943bf374
Add missing `X-Total-Count` and fix some related bugs (#17968)
* Add missing `X-Total-Count` and fix some related bugs

Adds `X-Total-Count` header to APIs that return a list but doesn't have it yet.
Fixed bugs:
* not returned after reporting error (39eb82446c/routers/api/v1/user/star.go (L70))
* crash with index out of bounds, API issue/issueSubscriptions

I also found various endpoints that return lists but do not apply/support pagination yet:
```
/repos/{owner}/{repo}/issues/{index}/labels
/repos/{owner}/{repo}/issues/comments/{id}/reactions
/repos/{owner}/{repo}/branch_protections
/repos/{owner}/{repo}/contents
/repos/{owner}/{repo}/hooks/git
/repos/{owner}/{repo}/issue_templates
/repos/{owner}/{repo}/releases/{id}/assets
/repos/{owner}/{repo}/reviewers
/repos/{owner}/{repo}/teams
/user/emails
/users/{username}/heatmap
```
If this is not expected, an new issue should be opened.

Closes #13043

* fmt

* Update routers/api/v1/repo/issue_subscription.go

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

* Use FindAndCount

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
..
agit Move user related model into models/user (#17781) 3 years ago
asymkey Add missing `X-Total-Count` and fix some related bugs (#17968) 3 years ago
attachment Move user related model into models/user (#17781) 3 years ago
auth Add Option to synchronize Admin & Restricted states from OIDC/OAuth2 along with Setting Scopes (#16766) 3 years ago
comments Move repository model into models/repo (#17933) 3 years ago
cron Some repository refactors (#17950) 3 years ago
externalaccount Add Option to synchronize Admin & Restricted states from OIDC/OAuth2 along with Setting Scopes (#16766) 3 years ago
forms Add Option to synchronize Admin & Restricted states from OIDC/OAuth2 along with Setting Scopes (#16766) 3 years ago
gitdiff Make Requests Processes and create process hierarchy. Associate OpenRepository with context. (#17125) 3 years ago
issue Move repository model into models/repo (#17933) 3 years ago
lfs Move repository model into models/repo (#17933) 3 years ago
mailer Add missing `X-Total-Count` and fix some related bugs (#17968) 3 years ago
migrations Some repository refactors (#17950) 3 years ago
mirror Some repository refactors (#17950) 3 years ago
org Move repository model into models/repo (#17933) 3 years ago
pull Add missing `X-Total-Count` and fix some related bugs (#17968) 3 years ago
release Move repository model into models/repo (#17933) 3 years ago
repository Some repository refactors (#17950) 3 years ago
task Some repository refactors (#17950) 3 years ago
user Move keys to models/asymkey (#17917) 3 years ago
webhook Add missing `X-Total-Count` and fix some related bugs (#17968) 3 years ago
wiki Some repository refactors (#17950) 3 years ago