diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-04 20:59:23 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-04 21:05:13 +0100 |
commit | 55fa55a9be566cca2ba95322f2ae23b434aed62a (patch) | |
tree | f51ef35c120ce8a928917a659418079538cdb8dc /server/helpers/utils.js | |
parent | a6fd2b30bf717eec14972a2175354781f5f43e77 (diff) | |
download | PeerTube-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.js | 16 |
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 | ||
14 | function badRequest (req, res, next) { | 15 | function 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 | ||
36 | function 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 | ||
37 | module.exports = utils | 51 | module.exports = utils |