aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorGreen-Star <Green-Star@users.noreply.github.com>2017-08-02 21:50:42 +0200
committerBigard Florian <florian.bigard@gmail.com>2017-08-02 21:50:42 +0200
commitd5f5a670fcf6258d0facf9a2fd3aabd550fbc78f (patch)
treebc945e1b6ab0f9cb36a481fea56cdfdaa8b1a341 /server/lib
parent291e8d3eed88fe714fb74ad897ac2c67347a85ff (diff)
downloadPeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.tar.gz
PeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.tar.zst
PeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.zip
Remove one pod (#76)
* Client: Fix typo * Client: Add removeFriend feature * Server: Add removeFriend feature * Server: Update method name * Fix rebase onto develop issues * Server: Fix error message * Server: Remove useless methods in removeFriend method * Server: Finish remove on pod feature after rebase * Server: Type pod parameter * Fix Travis build * Add friend-basic test for the remove one pod feature * Add check-params tests for the remove one pod feature * Fix typos * Add friend-advanced test for the remove one pod feature * Client: Trailing new line * Move to promises * Add undefined id test * Use find method instead of a for loop to find the friend to remove * Remove setTimeout method * Server: Remove requestScheduler operations * Server: Fix logging messages * Server: Remove sign request parameter
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/friends.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/lib/friends.ts b/server/lib/friends.ts
index 50355d5d1..bd3ff97a5 100644
--- a/server/lib/friends.ts
+++ b/server/lib/friends.ts
@@ -242,6 +242,23 @@ function fetchRemotePreview (pod: PodInstance, video: VideoInstance) {
242 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path) 242 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path)
243} 243}
244 244
245function removeFriend (pod: PodInstance) {
246 const requestParams = {
247 method: 'POST' as 'POST',
248 path: '/api/' + API_VERSION + '/remote/pods/remove',
249 toPod: pod
250 }
251
252 return makeSecureRequest(requestParams)
253 .then(() => pod.destroy())
254 .then(() => {
255 logger.info('Removed friend.')
256 })
257 .catch(err => {
258 logger.error('Some errors while quitting friend %s (id: %d).', pod.host, pod.id, err)
259 })
260}
261
245function getRequestScheduler () { 262function getRequestScheduler () {
246 return requestScheduler 263 return requestScheduler
247} 264}
@@ -268,6 +285,7 @@ export {
268 hasFriends, 285 hasFriends,
269 makeFriends, 286 makeFriends,
270 quitFriends, 287 quitFriends,
288 removeFriend,
271 removeVideoToFriends, 289 removeVideoToFriends,
272 sendOwnedVideosToPod, 290 sendOwnedVideosToPod,
273 getRequestScheduler, 291 getRequestScheduler,