Handle pagination for the federated actions & followers responses (#1731)

* Add pagination for admin social list

* Use Paginated API for followers tab on frontend
This commit is contained in:
Gabe Kangas
2022-03-06 17:18:51 -08:00
committed by GitHub
parent bdae263819
commit 5e6bc50b59
12 changed files with 118 additions and 38 deletions

View File

@@ -7,12 +7,16 @@ import (
)
// GetFollowers will handle an API request to fetch the list of followers (non-activitypub response).
func GetFollowers(w http.ResponseWriter, r *http.Request) {
followers, err := persistence.GetFederationFollowers(-1, 0)
func GetFollowers(offset int, limit int, w http.ResponseWriter, r *http.Request) {
followers, total, err := persistence.GetFederationFollowers(limit, offset)
if err != nil {
WriteSimpleResponse(w, false, "unable to fetch followers")
return
}
WriteResponse(w, followers)
response := PaginatedResponse{
Total: total,
Results: followers,
}
WriteResponse(w, response)
}