From 0e9c48c2edbb3871b0ca3ccd6718f2c99f9760b6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Apr 2019 11:52:29 +0200 Subject: Add ability to remove an instance follower in API --- shared/utils/server/follows.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'shared/utils') diff --git a/shared/utils/server/follows.ts b/shared/utils/server/follows.ts index 7741757a6..949fd8109 100644 --- a/shared/utils/server/follows.ts +++ b/shared/utils/server/follows.ts @@ -47,13 +47,21 @@ async function follow (follower: string, following: string[], accessToken: strin async function unfollow (url: string, accessToken: string, target: ServerInfo, expectedStatus = 204) { const path = '/api/v1/server/following/' + target.host - const res = await request(url) + return request(url) .delete(path) .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + accessToken) .expect(expectedStatus) +} - return res +function removeFollower (url: string, accessToken: string, follower: ServerInfo, expectedStatus = 204) { + const path = '/api/v1/server/followers/peertube@' + follower.host + + return request(url) + .delete(path) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + accessToken) + .expect(expectedStatus) } async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { @@ -74,6 +82,7 @@ export { getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow, + removeFollower, follow, doubleFollow } -- cgit v1.2.3