diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-08 14:30:29 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-09 11:41:22 +0100 |
commit | b49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch) | |
tree | a2825877d7b3b53454804a79c9d2a14c5d37385c /server/middlewares/validators | |
parent | 6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff) | |
download | PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.gz PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.zst PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.zip |
Upgrade sequelize to v6
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/users.ts | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index c93895f2f..6b6e6c2df 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -1,8 +1,14 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import * as express from 'express' | 1 | import * as express from 'express' |
3 | import { body, param, query } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
4 | import { omit } from 'lodash' | 3 | import { omit } from 'lodash' |
4 | import { Hooks } from '@server/lib/plugins/hooks' | ||
5 | import { MUserDefault } from '@server/types/models' | ||
6 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
7 | import { UserRole } from '../../../shared/models/users' | ||
8 | import { UserRegister } from '../../../shared/models/users/user-register.model' | ||
9 | import { isActorPreferredUsernameValid } from '../../helpers/custom-validators/activitypub/actor' | ||
5 | import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' | 10 | import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' |
11 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' | ||
6 | import { | 12 | import { |
7 | isNoInstanceConfigWarningModal, | 13 | isNoInstanceConfigWarningModal, |
8 | isNoWelcomeModal, | 14 | isNoWelcomeModal, |
@@ -22,22 +28,15 @@ import { | |||
22 | isUserVideoQuotaValid, | 28 | isUserVideoQuotaValid, |
23 | isUserVideosHistoryEnabledValid | 29 | isUserVideosHistoryEnabledValid |
24 | } from '../../helpers/custom-validators/users' | 30 | } from '../../helpers/custom-validators/users' |
31 | import { isVideoChannelNameValid } from '../../helpers/custom-validators/video-channels' | ||
25 | import { logger } from '../../helpers/logger' | 32 | import { logger } from '../../helpers/logger' |
33 | import { doesVideoExist } from '../../helpers/middlewares' | ||
26 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' | 34 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' |
35 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' | ||
27 | import { Redis } from '../../lib/redis' | 36 | import { Redis } from '../../lib/redis' |
28 | import { UserModel } from '../../models/account/user' | 37 | import { UserModel } from '../../models/account/user' |
29 | import { areValidationErrors } from './utils' | ||
30 | import { ActorModel } from '../../models/activitypub/actor' | 38 | import { ActorModel } from '../../models/activitypub/actor' |
31 | import { isActorPreferredUsernameValid } from '../../helpers/custom-validators/activitypub/actor' | 39 | import { areValidationErrors } from './utils' |
32 | import { isVideoChannelNameValid } from '../../helpers/custom-validators/video-channels' | ||
33 | import { UserRegister } from '../../../shared/models/users/user-register.model' | ||
34 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' | ||
35 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' | ||
36 | import { doesVideoExist } from '../../helpers/middlewares' | ||
37 | import { UserRole } from '../../../shared/models/users' | ||
38 | import { MUserDefault } from '@server/types/models' | ||
39 | import { Hooks } from '@server/lib/plugins/hooks' | ||
40 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
41 | 40 | ||
42 | const usersListValidator = [ | 41 | const usersListValidator = [ |
43 | query('blocked') | 42 | query('blocked') |
@@ -529,7 +528,7 @@ async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: | |||
529 | return true | 528 | return true |
530 | } | 529 | } |
531 | 530 | ||
532 | async function checkUserExist (finder: () => Bluebird<MUserDefault>, res: express.Response, abortResponse = true) { | 531 | async function checkUserExist (finder: () => Promise<MUserDefault>, res: express.Response, abortResponse = true) { |
533 | const user = await finder() | 532 | const user = await finder() |
534 | 533 | ||
535 | if (!user) { | 534 | if (!user) { |