X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fserver%2Ffollows.ts;h=006d591995aed439baf9b9ca787383ae81f102a6;hb=a30a136c9896c656cab98d2c92cde32c534dc098;hp=0379bb1098de61a9534541e4cbe19059d9648141;hpb=60919831276e9c9e9900258bec82b6c31e9e5dd3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/server/follows.ts b/shared/extra-utils/server/follows.ts index 0379bb109..006d59199 100644 --- a/shared/extra-utils/server/follows.ts +++ b/shared/extra-utils/server/follows.ts @@ -2,15 +2,27 @@ import * as request from 'supertest' import { ServerInfo } from './servers' import { waitJobs } from './jobs' import { makePostBodyRequest } from '../requests/requests' - -function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string, search?: string) { +import { ActivityPubActorType, FollowState } from '@shared/models' + +function getFollowersListPaginationAndSort (options: { + url: string + start: number + count: number + sort: string + search?: string + actorType?: ActivityPubActorType + state?: FollowState +}) { + const { url, start, count, sort, search, state, actorType } = options const path = '/api/v1/server/followers' const query = { start, count, sort, - search + search, + state, + actorType } return request(url) @@ -43,14 +55,25 @@ function rejectFollower (url: string, token: string, follower: string, statusCod }) } -function getFollowingListPaginationAndSort (url: string, start: number, count: number, sort: string, search?: string) { +function getFollowingListPaginationAndSort (options: { + url: string + start: number + count: number + sort: string + search?: string + actorType?: ActivityPubActorType + state?: FollowState +}) { + const { url, start, count, sort, search, state, actorType } = options const path = '/api/v1/server/following' const query = { start, count, sort, - search + search, + state, + actorType } return request(url) @@ -69,7 +92,7 @@ function follow (follower: string, following: string[], accessToken: string, exp .post(path) .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + accessToken) - .send({ 'hosts': followingHosts }) + .send({ hosts: followingHosts }) .expect(expectedStatus) }