]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/captions.ts
Guess if we need to generate the thumbnail for imports
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / captions.ts
index 37481d12f525b4291868bd626934d5a214a41df4..bf82e2c19f0600076b1b4c27c570ce3b7935a4c5 100644 (file)
@@ -6,11 +6,12 @@ import { MIMETYPES } from '../../../initializers/constants'
 import { getFormattedObjects } from '../../../helpers/utils'
 import { VideoCaptionModel } from '../../../models/video/video-caption'
 import { logger } from '../../../helpers/logger'
-import { federateVideoIfNeeded } from '../../../lib/activitypub'
+import { federateVideoIfNeeded } from '../../../lib/activitypub/videos'
 import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
 import { CONFIG } from '../../../initializers/config'
 import { sequelizeTypescript } from '../../../initializers/database'
-import { MVideoCaptionVideo } from '@server/typings/models'
+import { MVideoCaptionVideo } from '@server/types/models'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const reqVideoCaptionAdd = createReqFiles(
   [ 'captionfile' ],
@@ -66,13 +67,13 @@ async function addVideoCaption (req: express.Request, res: express.Response) {
   await moveAndProcessCaptionFile(videoCaptionPhysicalFile, videoCaption)
 
   await sequelizeTypescript.transaction(async t => {
-    await VideoCaptionModel.insertOrReplaceLanguage(video.id, req.params.captionLanguage, t)
+    await VideoCaptionModel.insertOrReplaceLanguage(video.id, req.params.captionLanguage, null, t)
 
     // Update video update
     await federateVideoIfNeeded(video, false, t)
   })
 
-  return res.status(204).end()
+  return res.status(HttpStatusCode.NO_CONTENT_204).end()
 }
 
 async function deleteVideoCaption (req: express.Request, res: express.Response) {
@@ -88,5 +89,5 @@ async function deleteVideoCaption (req: express.Request, res: express.Response)
 
   logger.info('Video caption %s of video %s deleted.', videoCaption.language, video.uuid)
 
-  return res.type('json').status(204).end()
+  return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
 }