From 6765abe1207ecb4e0914433401b4bf8f0ef6a0e0 Mon Sep 17 00:00:00 2001 From: vyneer Date: Mon, 27 Nov 2023 23:00:28 +0300 Subject: [PATCH] fix: provide defaults on empty user object --- assets/chat/js/user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/chat/js/user.js b/assets/chat/js/user.js index 8a846dc7..f8c069f3 100644 --- a/assets/chat/js/user.js +++ b/assets/chat/js/user.js @@ -47,11 +47,11 @@ class ChatUser { this.displayName = user; this.username = this.displayName.toLowerCase(); } else { - this.id = user.id; - this.displayName = user.nick; + this.id = user.id || null; + this.displayName = user.nick || ''; this.username = this.displayName.toLowerCase(); - this.createdDate = user.createdDate; - this.features = user.features; + this.createdDate = user.createdDate || ''; + this.features = user.features || []; } }