From 363fc7e02250bd9460102fff535193f38b97b8e0 Mon Sep 17 00:00:00 2001 From: Will Martin Date: Fri, 10 Mar 2023 09:53:15 -0500 Subject: [PATCH] [SM-590] show email as fallback name in SM header (#4957) * show email if name is falsy * update and use user-name pipe --- .../src/app/secrets-manager/shared/header.component.html | 9 +++------ libs/angular/src/pipes/user-name.pipe.ts | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html index bf31adfd1d..1648c02510 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html @@ -33,7 +33,7 @@ [bitMenuTriggerFor]="accountMenu" class="tw-border-0 tw-bg-transparent tw-p-0" > - + @@ -42,14 +42,11 @@ class="tw-flex tw-items-center tw-py-1 tw-px-4 tw-leading-tight tw-text-info" appStopProp > - +
{{ "loggedInAs" | i18n }} - {{ account.name }} + {{ account | userName }}
diff --git a/libs/angular/src/pipes/user-name.pipe.ts b/libs/angular/src/pipes/user-name.pipe.ts index 22c214e41e..88b088a7e2 100644 --- a/libs/angular/src/pipes/user-name.pipe.ts +++ b/libs/angular/src/pipes/user-name.pipe.ts @@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from "@angular/core"; interface User { name?: string; - email: string; + email?: string; } @Pipe({ @@ -14,6 +14,10 @@ export class UserNamePipe implements PipeTransform { return null; } + if (user.name == null && user.email == null) { + return null; + } + return user.name == null || user.name.trim() === "" ? user.email : user.name; } }