From 0e7bc18cbc1db86a9137475d98bcc715c75bdcf7 Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Thu, 7 Mar 2024 15:14:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Frontend=20user=20name=20display?= =?UTF-8?q?=20first=20letter=20in=20caps=20for=20both=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/features/users/services/current-user-service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tdrive/frontend/src/app/features/users/services/current-user-service.ts b/tdrive/frontend/src/app/features/users/services/current-user-service.ts index a82a8f11..6d4c3005 100755 --- a/tdrive/frontend/src/app/features/users/services/current-user-service.ts +++ b/tdrive/frontend/src/app/features/users/services/current-user-service.ts @@ -46,15 +46,17 @@ class User { if (!name) { return 'Anonymous'; } + // @author https://stackoverflow.com/a/17200679 + const toNameCase = (str?: string) => (str || '').toLowerCase().replace(/(? m.toUpperCase()); if (user.deleted) { name = Languages.t('general.user.deleted'); } else { - name = [user.first_name, user.last_name].filter(a => a).join(' '); + name = [user.first_name, user.last_name].filter(a => a).map(toNameCase).join(' '); name = name || user.username; } - return name.charAt(0).toUpperCase() + name.slice(1); + return name; } getThumbnail(user: UserType) {