aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/abuse.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
commit69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch)
treead199a18ec3c322460d6f9523fc383ee562554e0 /server/controllers/api/videos/abuse.ts
parent4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff)
downloadPeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip
Type functions
Diffstat (limited to 'server/controllers/api/videos/abuse.ts')
-rw-r--r--server/controllers/api/videos/abuse.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index 68db025b7..78e8e8b3d 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -1,4 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as Sequelize from 'sequelize'
2import { waterfall } from 'async' 3import { waterfall } from 'async'
3 4
4import { database as db } from '../../../initializers/database' 5import { database as db } from '../../../initializers/database'
@@ -46,7 +47,7 @@ export {
46 47
47// --------------------------------------------------------------------------- 48// ---------------------------------------------------------------------------
48 49
49function listVideoAbuses (req, res, next) { 50function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) {
50 db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort, function (err, abusesList, abusesTotal) { 51 db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort, function (err, abusesList, abusesTotal) {
51 if (err) return next(err) 52 if (err) return next(err)
52 53
@@ -54,7 +55,7 @@ function listVideoAbuses (req, res, next) {
54 }) 55 })
55} 56}
56 57
57function reportVideoAbuseRetryWrapper (req, res, next) { 58function reportVideoAbuseRetryWrapper (req: express.Request, res: express.Response, next: express.NextFunction) {
58 const options = { 59 const options = {
59 arguments: [ req, res ], 60 arguments: [ req, res ],
60 errorMessage: 'Cannot report abuse to the video with many retries.' 61 errorMessage: 'Cannot report abuse to the video with many retries.'
@@ -67,7 +68,7 @@ function reportVideoAbuseRetryWrapper (req, res, next) {
67 }) 68 })
68} 69}
69 70
70function reportVideoAbuse (req, res, finalCallback) { 71function reportVideoAbuse (req: express.Request, res: express.Response, finalCallback: (err: Error) => void) {
71 const videoInstance = res.locals.video 72 const videoInstance = res.locals.video
72 const reporterUsername = res.locals.oauth.token.User.username 73 const reporterUsername = res.locals.oauth.token.User.username
73 74
@@ -105,7 +106,7 @@ function reportVideoAbuse (req, res, finalCallback) {
105 106
106 commitTransaction 107 commitTransaction
107 108
108 ], function andFinally (err, t) { 109 ], function andFinally (err: Error, t: Sequelize.Transaction) {
109 if (err) { 110 if (err) {
110 logger.debug('Cannot update the video.', { error: err }) 111 logger.debug('Cannot update the video.', { error: err })
111 return rollbackTransaction(err, t, finalCallback) 112 return rollbackTransaction(err, t, finalCallback)