]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/import.ts
Ability for admins to set default upload values
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / import.ts
index 52864bdfde8a6d2226e6672144267281f33095c1..3c445efce0d7f5a2591bc2def17ffae769cd8511 100644 (file)
@@ -216,10 +216,10 @@ async function buildVideo (channelId: number, body: VideoImportCreate, importDat
     name: body.name || importData.name || 'Unknown name',
     remote: false,
     category: body.category || importData.category,
-    licence: body.licence || importData.licence,
+    licence: body.licence ?? importData.licence ?? CONFIG.DEFAULTS.PUBLISH.LICENCE,
     language: body.language || importData.language,
-    commentsEnabled: body.commentsEnabled !== false, // If the value is not "false", the default is "true"
-    downloadEnabled: body.downloadEnabled !== false,
+    commentsEnabled: body.commentsEnabled ?? CONFIG.DEFAULTS.PUBLISH.COMMENTS_ENABLED,
+    downloadEnabled: body.downloadEnabled ?? CONFIG.DEFAULTS.PUBLISH.DOWNLOAD_ENABLED,
     waitTranscoding: body.waitTranscoding || false,
     state: VideoState.TO_IMPORT,
     nsfw: body.nsfw || importData.nsfw || false,