aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users.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/controllers/api/users.js
parenta6fd2b30bf717eec14972a2175354781f5f43e77 (diff)
downloadPeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.tar.gz
PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.tar.zst
PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.zip
Server: add video abuse support
Diffstat (limited to 'server/controllers/api/users.js')
-rw-r--r--server/controllers/api/users.js18
1 files changed, 2 insertions, 16 deletions
diff --git a/server/controllers/api/users.js b/server/controllers/api/users.js
index 53bf56790..6cd0e84f7 100644
--- a/server/controllers/api/users.js
+++ b/server/controllers/api/users.js
@@ -6,6 +6,7 @@ const waterfall = require('async/waterfall')
6const constants = require('../../initializers/constants') 6const constants = require('../../initializers/constants')
7const db = require('../../initializers/database') 7const db = require('../../initializers/database')
8const logger = require('../../helpers/logger') 8const logger = require('../../helpers/logger')
9const utils = require('../../helpers/utils')
9const middlewares = require('../../middlewares') 10const middlewares = require('../../middlewares')
10const admin = middlewares.admin 11const admin = middlewares.admin
11const oAuth = middlewares.oauth 12const oAuth = middlewares.oauth
@@ -82,7 +83,7 @@ function listUsers (req, res, next) {
82 db.User.listForApi(req.query.start, req.query.count, req.query.sort, function (err, usersList, usersTotal) { 83 db.User.listForApi(req.query.start, req.query.count, req.query.sort, function (err, usersList, usersTotal) {
83 if (err) return next(err) 84 if (err) return next(err)
84 85
85 res.json(getFormatedUsers(usersList, usersTotal)) 86 res.json(utils.getFormatedObjects(usersList, usersTotal))
86 }) 87 })
87} 88}
88 89
@@ -121,18 +122,3 @@ function updateUser (req, res, next) {
121function success (req, res, next) { 122function success (req, res, next) {
122 res.end() 123 res.end()
123} 124}
124
125// ---------------------------------------------------------------------------
126
127function getFormatedUsers (users, usersTotal) {
128 const formatedUsers = []
129
130 users.forEach(function (user) {
131 formatedUsers.push(user.toFormatedJSON())
132 })
133
134 return {
135 total: usersTotal,
136 data: formatedUsers
137 }
138}