diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/utils/server/follows.ts | 13 |
1 files changed, 11 insertions, 2 deletions
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 | |||
47 | async function unfollow (url: string, accessToken: string, target: ServerInfo, expectedStatus = 204) { | 47 | async function unfollow (url: string, accessToken: string, target: ServerInfo, expectedStatus = 204) { |
48 | const path = '/api/v1/server/following/' + target.host | 48 | const path = '/api/v1/server/following/' + target.host |
49 | 49 | ||
50 | const res = await request(url) | 50 | return request(url) |
51 | .delete(path) | 51 | .delete(path) |
52 | .set('Accept', 'application/json') | 52 | .set('Accept', 'application/json') |
53 | .set('Authorization', 'Bearer ' + accessToken) | 53 | .set('Authorization', 'Bearer ' + accessToken) |
54 | .expect(expectedStatus) | 54 | .expect(expectedStatus) |
55 | } | ||
55 | 56 | ||
56 | return res | 57 | function removeFollower (url: string, accessToken: string, follower: ServerInfo, expectedStatus = 204) { |
58 | const path = '/api/v1/server/followers/peertube@' + follower.host | ||
59 | |||
60 | return request(url) | ||
61 | .delete(path) | ||
62 | .set('Accept', 'application/json') | ||
63 | .set('Authorization', 'Bearer ' + accessToken) | ||
64 | .expect(expectedStatus) | ||
57 | } | 65 | } |
58 | 66 | ||
59 | async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { | 67 | async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { |
@@ -74,6 +82,7 @@ export { | |||
74 | getFollowersListPaginationAndSort, | 82 | getFollowersListPaginationAndSort, |
75 | getFollowingListPaginationAndSort, | 83 | getFollowingListPaginationAndSort, |
76 | unfollow, | 84 | unfollow, |
85 | removeFollower, | ||
77 | follow, | 86 | follow, |
78 | doubleFollow | 87 | doubleFollow |
79 | } | 88 | } |