aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/activitypub.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-22 11:27:40 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commitc46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (patch)
tree073e32adb1bf93a597a269432e33a8f28365deb5 /server/helpers/activitypub.ts
parentc986175d68a18e96fbd41537a05c7796a2c64f38 (diff)
downloadPeerTube-c46edbc2f6ca310b2f0331f979ac6caf27f6eb92.tar.gz
PeerTube-c46edbc2f6ca310b2f0331f979ac6caf27f6eb92.tar.zst
PeerTube-c46edbc2f6ca310b2f0331f979ac6caf27f6eb92.zip
Fetch outbox to grab old activities tests
Diffstat (limited to 'server/helpers/activitypub.ts')
-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