diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-03 16:38:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-03 16:38:50 +0100 |
commit | 265ba139ebf56bbdc1c65f6ea4f367774c691fc0 (patch) | |
tree | c7c52d1ae48a35b8f9aa06a9fa2335a6ba502fd1 /server/middlewares/validators/account.ts | |
parent | 9bce811268cd74b402176ae9fcd8b77ac887576e (diff) | |
download | PeerTube-265ba139ebf56bbdc1c65f6ea4f367774c691fc0.tar.gz PeerTube-265ba139ebf56bbdc1c65f6ea4f367774c691fc0.tar.zst PeerTube-265ba139ebf56bbdc1c65f6ea4f367774c691fc0.zip |
Send account activitypub update events
Diffstat (limited to 'server/middlewares/validators/account.ts')
-rw-r--r-- | server/middlewares/validators/account.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts index 3573a9a50..ebc2fcf2d 100644 --- a/server/middlewares/validators/account.ts +++ b/server/middlewares/validators/account.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { param } from 'express-validator/check' | 2 | import { param } from 'express-validator/check' |
3 | import { isAccountNameValid, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts' | 3 | import { isAccountIdExist, isAccountNameValid, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts' |
4 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
4 | import { logger } from '../../helpers/logger' | 5 | import { logger } from '../../helpers/logger' |
5 | import { areValidationErrors } from './utils' | 6 | import { areValidationErrors } from './utils' |
6 | 7 | ||
@@ -17,8 +18,22 @@ const localAccountValidator = [ | |||
17 | } | 18 | } |
18 | ] | 19 | ] |
19 | 20 | ||
21 | const accountsGetValidator = [ | ||
22 | param('id').custom(isIdOrUUIDValid).withMessage('Should have a valid id'), | ||
23 | |||
24 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
25 | logger.debug('Checking accountsGetValidator parameters', { parameters: req.params }) | ||
26 | |||
27 | if (areValidationErrors(req, res)) return | ||
28 | if (!await isAccountIdExist(req.params.id, res)) return | ||
29 | |||
30 | return next() | ||
31 | } | ||
32 | ] | ||
33 | |||
20 | // --------------------------------------------------------------------------- | 34 | // --------------------------------------------------------------------------- |
21 | 35 | ||
22 | export { | 36 | export { |
23 | localAccountValidator | 37 | localAccountValidator, |
38 | accountsGetValidator | ||
24 | } | 39 | } |