From ed56ad1193bb5bb0a81fb843a11eb90d3fed9861 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Apr 2018 10:03:40 +0200 Subject: Add ability to update the user display name/description --- server/helpers/custom-validators/users.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'server/helpers/custom-validators') diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index c0acb8218..b59b766de 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -22,6 +22,10 @@ function isUserUsernameValid (value: string) { return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`)) } +function isUserDisplayNameValid (value: string) { + return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.NAME)) +} + function isUserDescriptionValid (value: string) { return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION)) } @@ -60,6 +64,7 @@ export { isUserUsernameValid, isUserNSFWPolicyValid, isUserAutoPlayVideoValid, + isUserDisplayNameValid, isUserDescriptionValid, isAvatarFile } -- cgit v1.2.3