From d07e263a81b88ef5f1ccb38158aab2203da72bc1 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 2 Sep 2022 23:58:15 +0200 Subject: [PATCH] Navigation: Improve error handling when showing user information #98 Signed-off-by: Michael Mayer --- frontend/src/component/navigation.vue | 135 ++++++++++++++++++++------ 1 file changed, 105 insertions(+), 30 deletions(-) diff --git a/frontend/src/component/navigation.vue b/frontend/src/component/navigation.vue index b6c5b8e52..046ac2132 100644 --- a/frontend/src/component/navigation.vue +++ b/frontend/src/component/navigation.vue @@ -2,7 +2,7 @@
- + Monochrome @@ -148,7 +150,8 @@ Review - {{ config.count.review | abbreviateCount }} + {{ config.count.review | abbreviateCount }} @@ -180,7 +183,8 @@ Albums - {{ config.count.albums | abbreviateCount }} + {{ config.count.albums | abbreviateCount }} @@ -213,7 +217,8 @@ Videos - {{ config.count.videos | abbreviateCount }} + {{ config.count.videos | abbreviateCount }} @@ -223,7 +228,8 @@ Live - {{ config.count.live | abbreviateCount }} + {{ config.count.live | abbreviateCount }} @@ -251,7 +257,8 @@ Favorites - {{ config.count.favorites | abbreviateCount }} + {{ config.count.favorites | abbreviateCount }} @@ -315,7 +322,8 @@ States - {{ config.count.states | abbreviateCount }} + {{ config.count.states | abbreviateCount }} @@ -357,7 +365,8 @@ Private - {{ config.count.private | abbreviateCount }} + {{ config.count.private | abbreviateCount }} @@ -389,7 +398,8 @@ Originals - {{ config.count.files | abbreviateCount }} + {{ config.count.files | abbreviateCount }} @@ -398,7 +408,8 @@ Hidden - {{ config.count.hidden | abbreviateCount }} + {{ config.count.hidden | abbreviateCount }} @@ -479,7 +490,8 @@ - + wifi_off @@ -493,7 +505,7 @@ - {{ displayName.length >= 1 ? displayName[0].toUpperCase() : "E" }} + {{ !!displayName ? displayName[0].toUpperCase() : "E" }} @@ -526,27 +538,82 @@
@@ -631,7 +698,15 @@ export default { }, displayName() { const user = this.$session.getUser(); - return user.DisplayName ? user.DisplayName : user.Username; + if (!user) { + return ''; + } else if (user.DisplayName) { + return user.DisplayName; + } else if (user.Username) { + return user.Username; + } else { + return 'User'; + } }, accountInfo() { const user = this.$session.getUser();