1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

[SM-590] show email as fallback name in SM header (#4957)

* show email if name is falsy

* update and use user-name pipe
This commit is contained in:
Will Martin 2023-03-10 09:53:15 -05:00 committed by GitHub
parent e57bc7f781
commit 363fc7e022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -33,7 +33,7 @@
[bitMenuTriggerFor]="accountMenu"
class="tw-border-0 tw-bg-transparent tw-p-0"
>
<bit-avatar [id]="account.userId" [text]="account.name || account.email"></bit-avatar>
<bit-avatar [id]="account.userId" [text]="account | userName"></bit-avatar>
</button>
<bit-menu #accountMenu>
@ -42,14 +42,11 @@
class="tw-flex tw-items-center tw-py-1 tw-px-4 tw-leading-tight tw-text-info"
appStopProp
>
<bit-avatar
[text]="account.name || account.email"
[id]="account.userId"
></bit-avatar>
<bit-avatar [text]="account | userName" [id]="account.userId"></bit-avatar>
<div class="tw-ml-2 tw-block tw-overflow-hidden tw-whitespace-nowrap">
<span>{{ "loggedInAs" | i18n }}</span>
<small class="tw-block tw-overflow-hidden tw-whitespace-nowrap tw-text-muted">
{{ account.name }}
{{ account | userName }}
</small>
</div>
</div>

View File

@ -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;
}
}