diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-28 15:30:36 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-28 15:34:55 +0100 |
commit | fba87e27c1cb6c679fff0d2c50be230f7e0c3e56 (patch) | |
tree | d7fe489c57056a8c1cba3d199a90053ff547f4ad /server | |
parent | 81d02aac56d76227c094d40b17b29875d88417f4 (diff) | |
download | PeerTube-fba87e27c1cb6c679fff0d2c50be230f7e0c3e56.tar.gz PeerTube-fba87e27c1cb6c679fff0d2c50be230f7e0c3e56.tar.zst PeerTube-fba87e27c1cb6c679fff0d2c50be230f7e0c3e56.zip |
Resolve enums at compile time
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/custom-validators/users.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 105c36600..b04970108 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -90,7 +90,7 @@ function isUserBlockedReasonValid (value: any) { | |||
90 | } | 90 | } |
91 | 91 | ||
92 | function isUserRoleValid (value: any) { | 92 | function isUserRoleValid (value: any) { |
93 | return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined | 93 | return exists(value) && validator.isInt('' + value) && [ UserRole.ADMINISTRATOR, UserRole.MODERATOR, UserRole.USER ].includes(value) |
94 | } | 94 | } |
95 | 95 | ||
96 | // --------------------------------------------------------------------------- | 96 | // --------------------------------------------------------------------------- |