Fix default true values when uploding videos
authorChocobozzz <me@florianbigard.com>
Wed, 28 Aug 2019 14:03:26 +0000 (16:03 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 28 Aug 2019 14:03:26 +0000 (16:03 +0200)
server/controllers/api/videos/import.ts
server/controllers/api/videos/index.ts

index ebe8718c72955df2c1afd4eecfaa3037fbbfe42f..28ced58368b2939f0957d09cb0f69f0723793646 100644 (file)
@@ -190,8 +190,8 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
     category: body.category || importData.category,
     licence: body.licence || importData.licence,
     language: body.language || undefined,
-    commentsEnabled: body.commentsEnabled && true,
-    downloadEnabled: body.downloadEnabled && true,
+    commentsEnabled: body.commentsEnabled !== false, // If the value is not "false", the default is "true"
+    downloadEnabled: body.downloadEnabled !== false,
     waitTranscoding: body.waitTranscoding || false,
     state: VideoState.TO_IMPORT,
     nsfw: body.nsfw || importData.nsfw || false,
index b4f6565751b89caaa8e128fb82908d65a7156ab2..19da504c75860357c4520e543e521063774a6ad3 100644 (file)
@@ -186,7 +186,7 @@ async function addVideo (req: express.Request, res: express.Response) {
     licence: videoInfo.licence,
     language: videoInfo.language,
     commentsEnabled: videoInfo.commentsEnabled || false,
-    downloadEnabled: videoInfo.downloadEnabled || true,
+    downloadEnabled: videoInfo.downloadEnabled !== false, // If the value is not "false", the default is "true"
     waitTranscoding: videoInfo.waitTranscoding || false,
     state: CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED,
     nsfw: videoInfo.nsfw || false,