diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-07-02 22:49:51 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-07-02 22:50:33 +0200 |
commit | 8491293b02ed2ec53eb0fa128161ea0b08d3def9 (patch) | |
tree | b3d8dd2732f5876e39c73b7d917a7ad02f4e021a /server/controllers/api/users | |
parent | 2b587cad93381a1901df3c993bf1db90bbb0891f (diff) | |
download | PeerTube-8491293b02ed2ec53eb0fa128161ea0b08d3def9.tar.gz PeerTube-8491293b02ed2ec53eb0fa128161ea0b08d3def9.tar.zst PeerTube-8491293b02ed2ec53eb0fa128161ea0b08d3def9.zip |
add blocked filter in users list to filter banned users
fixes #2914
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r-- | server/controllers/api/users/index.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index c8e9eaeaa..839431afb 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -18,6 +18,7 @@ import { | |||
18 | setDefaultPagination, | 18 | setDefaultPagination, |
19 | setDefaultSort, | 19 | setDefaultSort, |
20 | userAutocompleteValidator, | 20 | userAutocompleteValidator, |
21 | usersListValidator, | ||
21 | usersAddValidator, | 22 | usersAddValidator, |
22 | usersGetValidator, | 23 | usersGetValidator, |
23 | usersRegisterValidator, | 24 | usersRegisterValidator, |
@@ -85,6 +86,7 @@ usersRouter.get('/', | |||
85 | usersSortValidator, | 86 | usersSortValidator, |
86 | setDefaultSort, | 87 | setDefaultSort, |
87 | setDefaultPagination, | 88 | setDefaultPagination, |
89 | asyncMiddleware(usersListValidator), | ||
88 | asyncMiddleware(listUsers) | 90 | asyncMiddleware(listUsers) |
89 | ) | 91 | ) |
90 | 92 | ||
@@ -282,7 +284,13 @@ async function autocompleteUsers (req: express.Request, res: express.Response) { | |||
282 | } | 284 | } |
283 | 285 | ||
284 | async function listUsers (req: express.Request, res: express.Response) { | 286 | async function listUsers (req: express.Request, res: express.Response) { |
285 | const resultList = await UserModel.listForApi(req.query.start, req.query.count, req.query.sort, req.query.search) | 287 | const resultList = await UserModel.listForApi({ |
288 | start: req.query.start, | ||
289 | count: req.query.count, | ||
290 | sort: req.query.sort, | ||
291 | search: req.query.search, | ||
292 | blocked: req.query.blocked | ||
293 | }) | ||
286 | 294 | ||
287 | return res.json(getFormattedObjects(resultList.data, resultList.total, { withAdminFlags: true })) | 295 | return res.json(getFormattedObjects(resultList.data, resultList.total, { withAdminFlags: true })) |
288 | } | 296 | } |