0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-01 03:32:00 +01:00
gitea/routers/web/repo
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>
2021-12-15 13:39:34 +08:00
..
activity.go
attachment.go
blame.go
branch.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
commit.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
compare.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
download.go
editor_test.go
editor.go
http_test.go
http.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
issue_content_history.go
issue_dependency.go
issue_label_test.go
issue_label.go
issue_lock.go
issue_stopwatch.go
issue_test.go
issue_timetrack.go
issue_watch.go
issue.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
lfs.go
main_test.go
middlewares.go
migrate.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
milestone.go
projects_test.go
projects.go
pull_review.go
pull.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
release_test.go
release.go
repo.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
search.go
setting_protected_branch.go
setting.go Return nicer error for ForcePrivate (#17971) 2021-12-14 00:08:09 -05:00
settings_test.go
tag.go
topic.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
view.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
webhook.go
wiki_test.go
wiki.go