]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video.js
Server: use video hook to send information to other pods when a video is
[github/Chocobozzz/PeerTube.git] / server / models / video.js
index d1595ce515ddad8fe2c7c8e0ab5d79ba7d91b4a6..564e362fdd244fbf85a3d7b2dbb6a1b2d3ee3817 100644 (file)
@@ -12,6 +12,7 @@ const values = require('lodash/values')
 
 const constants = require('../initializers/constants')
 const logger = require('../helpers/logger')
+const friends = require('../lib/friends')
 const modelUtils = require('./utils')
 const customVideosValidators = require('../helpers/custom-validators').videos
 
@@ -205,11 +206,24 @@ function afterDestroy (video, options, next) {
       function (callback) {
         removeFile(video, callback)
       },
+
       function (callback) {
         removeTorrent(video, callback)
       },
+
       function (callback) {
         removePreview(video, callback)
+      },
+
+      function (callback) {
+        const params = {
+          name: video.name,
+          remoteId: video.id
+        }
+
+        friends.removeVideoToFriends(params)
+
+        return callback()
       }
     )
   }