From a4c157519738d89f8a77143b91e92dfd2e70380a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 18 Mar 2016 16:34:50 +0100 Subject: [PATCH] Use map instead of pluck (lodash) --- server/controllers/api/v1/remoteVideos.js | 4 ++-- server/middlewares/reqValidators/videos.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/controllers/api/v1/remoteVideos.js b/server/controllers/api/v1/remoteVideos.js index 58222de52..2437b8c44 100644 --- a/server/controllers/api/v1/remoteVideos.js +++ b/server/controllers/api/v1/remoteVideos.js @@ -1,7 +1,7 @@ 'use strict' const express = require('express') -const pluck = require('lodash-node/compat/collection/pluck') +const map = require('lodash-node/modern/collection/map') const middleware = require('../../../middlewares') const secureMiddleware = middleware.secure @@ -43,7 +43,7 @@ function addRemoteVideos (req, res, next) { function removeRemoteVideo (req, res, next) { const url = req.body.signature.url - const magnetUris = pluck(req.body.data, 'magnetUri') + const magnetUris = map(req.body.data, 'magnetUri') videos.removeRemotesOfByMagnetUris(url, magnetUris, function (err) { if (err) return next(err) diff --git a/server/middlewares/reqValidators/videos.js b/server/middlewares/reqValidators/videos.js index 12e878e81..c20660452 100644 --- a/server/middlewares/reqValidators/videos.js +++ b/server/middlewares/reqValidators/videos.js @@ -13,8 +13,8 @@ const reqValidatorsVideos = { } function videosAdd (req, res, next) { - req.checkFiles('input_video[0].originalname', 'Should have an input video').notEmpty() - req.checkFiles('input_video[0].mimetype', 'Should have a correct mime type').matches(/video\/(webm)|(mp4)|(ogg)/i) + req.checkFiles('videofile[0].originalname', 'Should have an input video').notEmpty() + req.checkFiles('videofile[0].mimetype', 'Should have a correct mime type').matches(/video\/(webm)|(mp4)|(ogg)/i) req.checkBody('name', 'Should have a name').isLength(1, 50) req.checkBody('description', 'Should have a description').isLength(1, 250)