aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/activitypub.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index fb4a43a01..54c460200 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -24,12 +24,15 @@ function activityPubContextify <T> (data: T) {
24 }) 24 })
25} 25}
26 26
27function activityPubCollectionPagination (url: string, page: number, result: ResultList<any>) { 27function activityPubCollectionPagination (url: string, page: any, result: ResultList<any>) {
28 let next: string 28 let next: string
29 let prev: string 29 let prev: string
30 30
31 // Assert page is a number
32 page = parseInt(page, 10)
33
31 // There are more results 34 // There are more results
32 if (result.total > ((page + 1) * ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)) { 35 if (result.total > page * ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) {
33 next = url + '?page=' + (page + 1) 36 next = url + '?page=' + (page + 1)
34 } 37 }
35 38
@@ -53,6 +56,8 @@ function activityPubCollectionPagination (url: string, page: number, result: Res
53 totalItems: result.total, 56 totalItems: result.total,
54 first: orderedCollectionPagination 57 first: orderedCollectionPagination
55 }) 58 })
59 } else {
60 orderedCollectionPagination['totalItems'] = result.total
56 } 61 }
57 62
58 return orderedCollectionPagination 63 return orderedCollectionPagination