]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/abuse.ts
Cleanup express locals typings
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / abuse.ts
index 32f9c47937d10b11ba9709824c51172e52b245f4..ca70230a2f475eb05e7a7f40c9821a62fdf15b12 100644 (file)
@@ -17,10 +17,8 @@ import {
   videoAbuseUpdateValidator
 } from '../../../middlewares'
 import { AccountModel } from '../../../models/account/account'
-import { VideoModel } from '../../../models/video/video'
 import { VideoAbuseModel } from '../../../models/video/video-abuse'
 import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
-import { UserModel } from '../../../models/account/user'
 import { Notifier } from '../../../lib/notifier'
 import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
 
@@ -69,7 +67,7 @@ async function listVideoAbuses (req: express.Request, res: express.Response) {
 }
 
 async function updateVideoAbuse (req: express.Request, res: express.Response) {
-  const videoAbuse: VideoAbuseModel = res.locals.videoAbuse
+  const videoAbuse = res.locals.videoAbuse
 
   if (req.body.moderationComment !== undefined) videoAbuse.moderationComment = req.body.moderationComment
   if (req.body.state !== undefined) videoAbuse.state = req.body.state
@@ -84,7 +82,7 @@ async function updateVideoAbuse (req: express.Request, res: express.Response) {
 }
 
 async function deleteVideoAbuse (req: express.Request, res: express.Response) {
-  const videoAbuse: VideoAbuseModel = res.locals.videoAbuse
+  const videoAbuse = res.locals.videoAbuse
 
   await sequelizeTypescript.transaction(t => {
     return videoAbuse.destroy({ transaction: t })
@@ -96,11 +94,11 @@ async function deleteVideoAbuse (req: express.Request, res: express.Response) {
 }
 
 async function reportVideoAbuse (req: express.Request, res: express.Response) {
-  const videoInstance = res.locals.video as VideoModel
+  const videoInstance = res.locals.video
   const body: VideoAbuseCreate = req.body
 
   const videoAbuse: VideoAbuseModel = await sequelizeTypescript.transaction(async t => {
-    const reporterAccount = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t)
+    const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
 
     const abuseToCreate = {
       reporterAccountId: reporterAccount.id,