diff options
author | Andréas Livet <andreas.livet@gmail.com> | 2017-12-19 10:45:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 10:45:49 +0100 |
commit | 7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd (patch) | |
tree | 56116e7e9f8467b78ed6dfc81827288915d31c8c /server/middlewares/validators/users.ts | |
parent | 228077efd73485a2832bb6211c9fa923158c2112 (diff) | |
download | PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.gz PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.zst PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.zip |
Enh #106 : Add an autoPlayVideo user attribute (#159)
Warning : I was not able to run the tests on my machine. It uses a different approach to handle databse connexion and didn't find where to configure it...
- create a migration file to add a boolean column in user table
- add autoPlayVideo attribute everywhere it is needed (both on client and server side)
- add tests
- add a way to configure this attribute in account-settings
- use the attribute in video-watch component to actually autoplay or not the video
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r-- | server/middlewares/validators/users.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 920176d07..a6fdbe268 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -5,6 +5,7 @@ import { isSignupAllowed, logger } from '../../helpers' | |||
5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
6 | import { | 6 | import { |
7 | isUserDisplayNSFWValid, | 7 | isUserDisplayNSFWValid, |
8 | isUserAutoPlayVideoValid, | ||
8 | isUserPasswordValid, | 9 | isUserPasswordValid, |
9 | isUserRoleValid, | 10 | isUserRoleValid, |
10 | isUserUsernameValid, | 11 | isUserUsernameValid, |
@@ -86,6 +87,7 @@ const usersUpdateMeValidator = [ | |||
86 | body('password').optional().custom(isUserPasswordValid).withMessage('Should have a valid password'), | 87 | body('password').optional().custom(isUserPasswordValid).withMessage('Should have a valid password'), |
87 | body('email').optional().isEmail().withMessage('Should have a valid email attribute'), | 88 | body('email').optional().isEmail().withMessage('Should have a valid email attribute'), |
88 | body('displayNSFW').optional().custom(isUserDisplayNSFWValid).withMessage('Should have a valid display Not Safe For Work attribute'), | 89 | body('displayNSFW').optional().custom(isUserDisplayNSFWValid).withMessage('Should have a valid display Not Safe For Work attribute'), |
90 | body('autoPlayVideo').optional().custom(isUserAutoPlayVideoValid).withMessage('Should have a valid automatically plays video attribute'), | ||
89 | 91 | ||
90 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 92 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
91 | // TODO: Add old password verification | 93 | // TODO: Add old password verification |