From 3155c8606cff211f495bf71c75c56cae85a5430f Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Wed, 28 Aug 2019 16:03:26 +0200
Subject: [PATCH] Fix default true values when uploding videos

---
 server/controllers/api/videos/import.ts | 4 ++--
 server/controllers/api/videos/index.ts  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index ebe8718c72..28ced58368 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -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,
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index b4f6565751..19da504c75 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -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,
-- 
GitLab