X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fuser-notifications.ts;h=252c107db762c319cbbcdf057e447f51b30feb75;hb=eb34ec30e0b57286fc6f85160490d2e973a3b0b1;hp=5a4d10504e6c0812c2f33e0ac00953fbbf0d4f07;hpb=7cde3b9c2e84ea20bb0aae4544598483cde9e22c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/user-notifications.ts b/server/helpers/custom-validators/user-notifications.ts index 5a4d10504..252c107db 100644 --- a/server/helpers/custom-validators/user-notifications.ts +++ b/server/helpers/custom-validators/user-notifications.ts @@ -1,15 +1,15 @@ -import { exists } from './misc' import validator from 'validator' -import { UserNotificationType } from '../../../shared/models/users' import { UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' +import { exists } from './misc' function isUserNotificationTypeValid (value: any) { - return exists(value) && validator.isInt('' + value) && UserNotificationType[value] !== undefined + return exists(value) && validator.isInt('' + value) } function isUserNotificationSettingValid (value: any) { return exists(value) && - validator.isInt('' + value) && ( + validator.isInt('' + value) && + ( value === UserNotificationSettingValue.NONE || value === UserNotificationSettingValue.WEB || value === UserNotificationSettingValue.EMAIL ||