aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/abuse.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-22 10:43:11 +0200
committerChocobozzz <me@florianbigard.com>2019-08-22 10:43:11 +0200
commit5c5e587307a27e173333789b5b5167d35f468b01 (patch)
tree94e3721caf2e11d38fd5f4112c0fc98da89ac535 /server/controllers/api/videos/abuse.ts
parent1b42d73f44811eec1b7ddd72dd0d640a57c3376c (diff)
parentb5fecbf44192144d1ca27c23a0b53922de288c10 (diff)
downloadPeerTube-5c5e587307a27e173333789b5b5167d35f468b01.tar.gz
PeerTube-5c5e587307a27e173333789b5b5167d35f468b01.tar.zst
PeerTube-5c5e587307a27e173333789b5b5167d35f468b01.zip
Merge branch 'feature/strong-model-types' into develop
Diffstat (limited to 'server/controllers/api/videos/abuse.ts')
-rw-r--r--server/controllers/api/videos/abuse.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index 77808466c..39c841ffe 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -21,6 +21,7 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse'
21import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger' 21import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
22import { Notifier } from '../../../lib/notifier' 22import { Notifier } from '../../../lib/notifier'
23import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag' 23import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
24import { MVideoAbuseAccountVideo } from '../../../typings/models/video'
24 25
25const auditLogger = auditLoggerFactory('abuse') 26const auditLogger = auditLoggerFactory('abuse')
26const abuseVideoRouter = express.Router() 27const abuseVideoRouter = express.Router()
@@ -94,10 +95,10 @@ async function deleteVideoAbuse (req: express.Request, res: express.Response) {
94} 95}
95 96
96async function reportVideoAbuse (req: express.Request, res: express.Response) { 97async function reportVideoAbuse (req: express.Request, res: express.Response) {
97 const videoInstance = res.locals.video 98 const videoInstance = res.locals.videoAll
98 const body: VideoAbuseCreate = req.body 99 const body: VideoAbuseCreate = req.body
99 100
100 const videoAbuse: VideoAbuseModel = await sequelizeTypescript.transaction(async t => { 101 const videoAbuse = await sequelizeTypescript.transaction(async t => {
101 const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t) 102 const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
102 103
103 const abuseToCreate = { 104 const abuseToCreate = {
@@ -107,7 +108,7 @@ async function reportVideoAbuse (req: express.Request, res: express.Response) {
107 state: VideoAbuseState.PENDING 108 state: VideoAbuseState.PENDING
108 } 109 }
109 110
110 const videoAbuseInstance = await VideoAbuseModel.create(abuseToCreate, { transaction: t }) 111 const videoAbuseInstance: MVideoAbuseAccountVideo = await VideoAbuseModel.create(abuseToCreate, { transaction: t })
111 videoAbuseInstance.Video = videoInstance 112 videoAbuseInstance.Video = videoInstance
112 videoAbuseInstance.Account = reporterAccount 113 videoAbuseInstance.Account = reporterAccount
113 114