]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/abuse.ts
Formated -> Formatted
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / abuse.ts
index 3b1b7f58e07583ae71663fb6a38002d3a8b20c7e..c9313d5f5b680fb2b42326a266342930cc63c32b 100644 (file)
@@ -4,7 +4,7 @@ import { database as db } from '../../../initializers/database'
 import * as friends from '../../../lib/friends'
 import {
   logger,
-  getFormatedObjects,
+  getFormattedObjects,
   retryTransactionWrapper
 } from '../../../helpers'
 import {
@@ -17,6 +17,7 @@ import {
   setPagination
 } from '../../../middlewares'
 import { VideoInstance } from '../../../models'
+import { VideoAbuseCreate } from '../../../../shared'
 
 const abuseVideoRouter = express.Router()
 
@@ -45,7 +46,7 @@ export {
 
 function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) {
   db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort)
-    .then(result => res.json(getFormatedObjects(result.data, result.total)))
+    .then(result => res.json(getFormattedObjects(result.data, result.total)))
     .catch(err => next(err))
 }
 
@@ -61,12 +62,13 @@ function reportVideoAbuseRetryWrapper (req: express.Request, res: express.Respon
 }
 
 function reportVideoAbuse (req: express.Request, res: express.Response) {
-  const videoInstance = res.locals.video
+  const videoInstance = res.locals.video as VideoInstance
   const reporterUsername = res.locals.oauth.token.User.username
+  const body: VideoAbuseCreate = req.body
 
   const abuse = {
     reporterUsername,
-    reason: req.body.reason,
+    reason: body.reason,
     videoId: videoInstance.id,
     reporterPodId: null // This is our pod that reported this abuse
   }
@@ -79,7 +81,7 @@ function reportVideoAbuse (req: express.Request, res: express.Response) {
           const reportData = {
             reporterUsername,
             reportReason: abuse.reason,
-            videoRemoteId: videoInstance.remoteId
+            videoUUID: videoInstance.uuid
           }
 
           return friends.reportAbuseVideoToFriend(reportData, videoInstance, t).then(() => videoInstance)