aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-28 15:30:36 +0100
committerChocobozzz <me@florianbigard.com>2021-12-28 15:34:55 +0100
commitfba87e27c1cb6c679fff0d2c50be230f7e0c3e56 (patch)
treed7fe489c57056a8c1cba3d199a90053ff547f4ad /server/helpers/custom-validators/users.ts
parent81d02aac56d76227c094d40b17b29875d88417f4 (diff)
downloadPeerTube-fba87e27c1cb6c679fff0d2c50be230f7e0c3e56.tar.gz
PeerTube-fba87e27c1cb6c679fff0d2c50be230f7e0c3e56.tar.zst
PeerTube-fba87e27c1cb6c679fff0d2c50be230f7e0c3e56.zip
Resolve enums at compile time
Diffstat (limited to 'server/helpers/custom-validators/users.ts')
-rw-r--r--server/helpers/custom-validators/users.ts2
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
92function isUserRoleValid (value: any) { 92function 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// ---------------------------------------------------------------------------