aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/abuse.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/abuse.ts')
-rw-r--r--server/controllers/api/videos/abuse.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index 32f9c4793..ca70230a2 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -17,10 +17,8 @@ import {
17 videoAbuseUpdateValidator 17 videoAbuseUpdateValidator
18} from '../../../middlewares' 18} from '../../../middlewares'
19import { AccountModel } from '../../../models/account/account' 19import { AccountModel } from '../../../models/account/account'
20import { VideoModel } from '../../../models/video/video'
21import { VideoAbuseModel } from '../../../models/video/video-abuse' 20import { VideoAbuseModel } from '../../../models/video/video-abuse'
22import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger' 21import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
23import { UserModel } from '../../../models/account/user'
24import { Notifier } from '../../../lib/notifier' 22import { Notifier } from '../../../lib/notifier'
25import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag' 23import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
26 24
@@ -69,7 +67,7 @@ async function listVideoAbuses (req: express.Request, res: express.Response) {
69} 67}
70 68
71async function updateVideoAbuse (req: express.Request, res: express.Response) { 69async function updateVideoAbuse (req: express.Request, res: express.Response) {
72 const videoAbuse: VideoAbuseModel = res.locals.videoAbuse 70 const videoAbuse = res.locals.videoAbuse
73 71
74 if (req.body.moderationComment !== undefined) videoAbuse.moderationComment = req.body.moderationComment 72 if (req.body.moderationComment !== undefined) videoAbuse.moderationComment = req.body.moderationComment
75 if (req.body.state !== undefined) videoAbuse.state = req.body.state 73 if (req.body.state !== undefined) videoAbuse.state = req.body.state
@@ -84,7 +82,7 @@ async function updateVideoAbuse (req: express.Request, res: express.Response) {
84} 82}
85 83
86async function deleteVideoAbuse (req: express.Request, res: express.Response) { 84async function deleteVideoAbuse (req: express.Request, res: express.Response) {
87 const videoAbuse: VideoAbuseModel = res.locals.videoAbuse 85 const videoAbuse = res.locals.videoAbuse
88 86
89 await sequelizeTypescript.transaction(t => { 87 await sequelizeTypescript.transaction(t => {
90 return videoAbuse.destroy({ transaction: t }) 88 return videoAbuse.destroy({ transaction: t })
@@ -96,11 +94,11 @@ async function deleteVideoAbuse (req: express.Request, res: express.Response) {
96} 94}
97 95
98async function reportVideoAbuse (req: express.Request, res: express.Response) { 96async function reportVideoAbuse (req: express.Request, res: express.Response) {
99 const videoInstance = res.locals.video as VideoModel 97 const videoInstance = res.locals.video
100 const body: VideoAbuseCreate = req.body 98 const body: VideoAbuseCreate = req.body
101 99
102 const videoAbuse: VideoAbuseModel = await sequelizeTypescript.transaction(async t => { 100 const videoAbuse: VideoAbuseModel = await sequelizeTypescript.transaction(async t => {
103 const reporterAccount = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t) 101 const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
104 102
105 const abuseToCreate = { 103 const abuseToCreate = {
106 reporterAccountId: reporterAccount.id, 104 reporterAccountId: reporterAccount.id,