diff options
| author | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-04-06 01:36:34 +0900 |
|---|---|---|
| committer | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-04-06 01:36:34 +0900 |
| commit | f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa (patch) | |
| tree | 736d3fe581b6b9169d8e676453019e1d2afec876 /src/models | |
| parent | Merge pull request #1403 from akihikodaki/duplicate (diff) | |
| download | sharkey-f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa.tar.gz sharkey-f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa.tar.bz2 sharkey-f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa.zip | |
Allow name property of user to be null
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/user.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/models/user.ts b/src/models/user.ts index f817c33aa2..92091c6879 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -21,7 +21,7 @@ type IUserBase = { deletedAt: Date; followersCount: number; followingCount: number; - name: string; + name?: string; postsCount: number; driveCapacity: number; username: string; @@ -99,8 +99,8 @@ export function validatePassword(password: string): boolean { return typeof password == 'string' && password != ''; } -export function isValidName(name: string): boolean { - return typeof name == 'string' && name.length < 30 && name.trim() != ''; +export function isValidName(name?: string): boolean { + return name === null || (typeof name == 'string' && name.length < 30 && name.trim() != ''); } export function isValidDescription(description: string): boolean { |