diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 11:17:11 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 11:17:11 +0100 |
commit | 98ac898a03ed7bbb4edec74fe823b3f2d6d4904a (patch) | |
tree | d96e2b5fe8db9b4f1f1628067910495ec5679e3e /server/controllers/api/videos.js | |
parent | 4712081f2a5f48749cf125d729e78b926ab28d6d (diff) | |
download | PeerTube-98ac898a03ed7bbb4edec74fe823b3f2d6d4904a.tar.gz PeerTube-98ac898a03ed7bbb4edec74fe823b3f2d6d4904a.tar.zst PeerTube-98ac898a03ed7bbb4edec74fe823b3f2d6d4904a.zip |
Server: use video hook to send information to other pods when a video is
deleted
Diffstat (limited to 'server/controllers/api/videos.js')
-rw-r--r-- | server/controllers/api/videos.js | 24 |
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) { |