diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 10:35:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 10:35:15 +0100 |
commit | dae86118ed5d4026d04acb9d0e36829b9ad8eb4e (patch) | |
tree | a5bf9c4487240bf75a9b328cad459a0587f90dea /server/controllers/api/videos/abuse.ts | |
parent | e65c0c5b1fab9c3d93f51721b2458cf5cf471f20 (diff) | |
download | PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.gz PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.zst PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.zip |
Cleanup express locals typings
Diffstat (limited to 'server/controllers/api/videos/abuse.ts')
-rw-r--r-- | server/controllers/api/videos/abuse.ts | 10 |
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' |
19 | import { AccountModel } from '../../../models/account/account' | 19 | import { AccountModel } from '../../../models/account/account' |
20 | import { VideoModel } from '../../../models/video/video' | ||
21 | import { VideoAbuseModel } from '../../../models/video/video-abuse' | 20 | import { VideoAbuseModel } from '../../../models/video/video-abuse' |
22 | import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger' | 21 | import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger' |
23 | import { UserModel } from '../../../models/account/user' | ||
24 | import { Notifier } from '../../../lib/notifier' | 22 | import { Notifier } from '../../../lib/notifier' |
25 | import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag' | 23 | import { 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 | ||
71 | async function updateVideoAbuse (req: express.Request, res: express.Response) { | 69 | async 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 | ||
86 | async function deleteVideoAbuse (req: express.Request, res: express.Response) { | 84 | async 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 | ||
98 | async function reportVideoAbuse (req: express.Request, res: express.Response) { | 96 | async 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, |