From c46edbc2f6ca310b2f0331f979ac6caf27f6eb92 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 22 Nov 2017 11:27:40 +0100 Subject: Fetch outbox to grab old activities tests --- server/helpers/activitypub.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'server/helpers/activitypub.ts') 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 (data: T) { }) } -function activityPubCollectionPagination (url: string, page: number, result: ResultList) { +function activityPubCollectionPagination (url: string, page: any, result: ResultList) { let next: string let prev: string + // Assert page is a number + page = parseInt(page, 10) + // There are more results - if (result.total > ((page + 1) * ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)) { + if (result.total > page * ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) { next = url + '?page=' + (page + 1) } @@ -53,6 +56,8 @@ function activityPubCollectionPagination (url: string, page: number, result: Res totalItems: result.total, first: orderedCollectionPagination }) + } else { + orderedCollectionPagination['totalItems'] = result.total } return orderedCollectionPagination -- cgit v1.2.3