aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-04 20:59:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-04 21:05:13 +0100
commit55fa55a9be566cca2ba95322f2ae23b434aed62a (patch)
treef51ef35c120ce8a928917a659418079538cdb8dc /server/helpers/utils.js
parenta6fd2b30bf717eec14972a2175354781f5f43e77 (diff)
downloadPeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.tar.gz
PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.tar.zst
PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.zip
Server: add video abuse support
Diffstat (limited to 'server/helpers/utils.js')
-rw-r--r--server/helpers/utils.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/server/helpers/utils.js b/server/helpers/utils.js
index 7e0c9823c..9f4b14582 100644
--- a/server/helpers/utils.js
+++ b/server/helpers/utils.js
@@ -8,7 +8,8 @@ const utils = {
8 badRequest, 8 badRequest,
9 cleanForExit, 9 cleanForExit,
10 generateRandomString, 10 generateRandomString,
11 isTestInstance 11 isTestInstance,
12 getFormatedObjects
12} 13}
13 14
14function badRequest (req, res, next) { 15function badRequest (req, res, next) {
@@ -32,6 +33,19 @@ function isTestInstance () {
32 return (process.env.NODE_ENV === 'test') 33 return (process.env.NODE_ENV === 'test')
33} 34}
34 35
36function getFormatedObjects (objects, objectsTotal) {
37 const formatedObjects = []
38
39 objects.forEach(function (object) {
40 formatedObjects.push(object.toFormatedJSON())
41 })
42
43 return {
44 total: objectsTotal,
45 data: formatedObjects
46 }
47}
48
35// --------------------------------------------------------------------------- 49// ---------------------------------------------------------------------------
36 50
37module.exports = utils 51module.exports = utils