aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos.js')
-rw-r--r--server/controllers/api/videos.js24
1 files changed, 6 insertions, 18 deletions
diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js
index 170224634..ddf85d77d 100644
--- a/server/controllers/api/videos.js
+++ b/server/controllers/api/videos.js
@@ -249,27 +249,15 @@ function removeVideo (req, res, next) {
249 const videoId = req.params.id 249 const videoId = req.params.id
250 250
251 waterfall([ 251 waterfall([
252 function getVideo (callback) { 252 function loadVideo (callback) {
253 db.Video.load(videoId, callback) 253 db.Video.load(videoId, function (err, video) {
254 }, 254 return callback(err, video)
255
256 function removeFromDB (video, callback) {
257 video.destroy().asCallback(function (err) {
258 if (err) return callback(err)
259
260 return callback(null, video)
261 }) 255 })
262 }, 256 },
263 257
264 function sendInformationToFriends (video, callback) { 258 function deleteVideo (video, callback) {
265 const params = { 259 // Informations to other pods will be sent by the afterDestroy video hook
266 name: video.name, 260 video.destroy().asCallback(callback)
267 remoteId: video.id
268 }
269
270 friends.removeVideoToFriends(params)
271
272 return callback(null)
273 } 261 }
274 ], function andFinally (err) { 262 ], function andFinally (err) {
275 if (err) { 263 if (err) {