1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Add torrent tests

This commit is contained in:
Chocobozzz 2018-08-07 15:17:17 +02:00
parent 187501f8b8
commit 3e17515e29
11 changed files with 144 additions and 59 deletions

View file

@ -97,7 +97,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
await processThumbnail(req, video)
await processPreview(req, video)
const tags = null
const tags = body.tags || undefined
const videoImportAttributes = {
magnetUri,
torrentName,
@ -224,11 +224,13 @@ function insertIntoDB (
videoCreated.VideoChannel = videoChannel
// Set tags to the video
if (tags !== undefined) {
if (tags) {
const tagInstances = await TagModel.findOrCreateTags(tags, t)
await videoCreated.$set('Tags', tagInstances, sequelizeOptions)
videoCreated.Tags = tagInstances
} else {
videoCreated.Tags = []
}
// Create video import object in database