diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-29 11:29:23 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-29 11:29:23 +0200 |
commit | 4bbfc6c606c8d3794bae25c64c516120af41f4eb (patch) | |
tree | 8d6012f3c04e55e7325e3f00eb9061776cc7a953 /server/middlewares/validators/users.ts | |
parent | 3ff5a19b4c988d6c712b7ce63c4cf04f99d047ce (diff) | |
download | PeerTube-4bbfc6c606c8d3794bae25c64c516120af41f4eb.tar.gz PeerTube-4bbfc6c606c8d3794bae25c64c516120af41f4eb.tar.zst PeerTube-4bbfc6c606c8d3794bae25c64c516120af41f4eb.zip |
API: Add ability to update video channel avatar
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r-- | server/middlewares/validators/users.ts | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 55a08a648..8ca9763a1 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -5,9 +5,9 @@ import { body, param } from 'express-validator/check' | |||
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 6 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
7 | import { | 7 | import { |
8 | isAvatarFile, | ||
9 | isUserAutoPlayVideoValid, | 8 | isUserAutoPlayVideoValid, |
10 | isUserDescriptionValid, isUserDisplayNameValid, | 9 | isUserDescriptionValid, |
10 | isUserDisplayNameValid, | ||
11 | isUserNSFWPolicyValid, | 11 | isUserNSFWPolicyValid, |
12 | isUserPasswordValid, | 12 | isUserPasswordValid, |
13 | isUserRoleValid, | 13 | isUserRoleValid, |
@@ -17,7 +17,6 @@ import { | |||
17 | import { isVideoExist } from '../../helpers/custom-validators/videos' | 17 | import { isVideoExist } from '../../helpers/custom-validators/videos' |
18 | import { logger } from '../../helpers/logger' | 18 | import { logger } from '../../helpers/logger' |
19 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/utils' | 19 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/utils' |
20 | import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' | ||
21 | import { Redis } from '../../lib/redis' | 20 | import { Redis } from '../../lib/redis' |
22 | import { UserModel } from '../../models/account/user' | 21 | import { UserModel } from '../../models/account/user' |
23 | import { areValidationErrors } from './utils' | 22 | import { areValidationErrors } from './utils' |
@@ -116,21 +115,6 @@ const usersUpdateMeValidator = [ | |||
116 | } | 115 | } |
117 | ] | 116 | ] |
118 | 117 | ||
119 | const usersUpdateMyAvatarValidator = [ | ||
120 | body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( | ||
121 | 'This file is not supported or too large. Please, make sure it is of the following type : ' | ||
122 | + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ') | ||
123 | ), | ||
124 | |||
125 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
126 | logger.debug('Checking usersUpdateMyAvatarValidator parameters', { files: req.files }) | ||
127 | |||
128 | if (areValidationErrors(req, res)) return | ||
129 | |||
130 | return next() | ||
131 | } | ||
132 | ] | ||
133 | |||
134 | const usersGetValidator = [ | 118 | const usersGetValidator = [ |
135 | param('id').isInt().not().isEmpty().withMessage('Should have a valid id'), | 119 | param('id').isInt().not().isEmpty().withMessage('Should have a valid id'), |
136 | 120 | ||
@@ -239,7 +223,6 @@ export { | |||
239 | ensureUserRegistrationAllowed, | 223 | ensureUserRegistrationAllowed, |
240 | ensureUserRegistrationAllowedForIP, | 224 | ensureUserRegistrationAllowedForIP, |
241 | usersGetValidator, | 225 | usersGetValidator, |
242 | usersUpdateMyAvatarValidator, | ||
243 | usersAskResetPasswordValidator, | 226 | usersAskResetPasswordValidator, |
244 | usersResetPasswordValidator | 227 | usersResetPasswordValidator |
245 | } | 228 | } |