1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

[SG-1030] [Defect] - Difference in Default Color (#4645)

* fix: use id in web

* fix: adjust logic for org name badge to use id
This commit is contained in:
Brandon Maharaj 2023-02-15 13:04:43 -05:00 committed by GitHub
parent cdb44dd774
commit ed69abe76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View File

@ -47,7 +47,12 @@
[bitMenuTriggerFor]="accountMenu"
class="tw-border-0 tw-bg-transparent tw-text-alt2 tw-opacity-70 hover:tw-opacity-90"
>
<dynamic-avatar [text]="name" size="xsmall" aria-hidden="true"></dynamic-avatar>
<dynamic-avatar
[text]="name"
[id]="userId"
size="xsmall"
aria-hidden="true"
></dynamic-avatar>
<i class="bwi bwi-caret-down bwi-sm" aria-hidden="true"></i>
</button>
<bit-menu class="dropdown-menu" #accountMenu>
@ -57,7 +62,7 @@
*ngIf="name"
appStopProp
>
<dynamic-avatar [text]="name" size="small"></dynamic-avatar>
<dynamic-avatar [text]="name" [id]="userId" size="small"></dynamic-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">{{

View File

@ -33,7 +33,8 @@
</div>
<div class="col-6">
<div class="mb-3">
<dynamic-avatar text="{{ profile | userName }}" [size]="'large'"> </dynamic-avatar>
<dynamic-avatar text="{{ profile | userName }}" [id]="profile.id" [size]="'large'">
</dynamic-avatar>
<button
type="button"
class="btn btn-outline-secondary tw-ml-3.5"

View File

@ -33,10 +33,15 @@ export class OrganizationNameBadgeComponent implements OnInit {
if (this.isMe) {
this.color = await this.avatarService.loadColorFromState();
if (this.color == null) {
const userId = await this.tokenService.getUserId();
if (userId != null) {
this.color = Utils.stringToColor(userId);
} else {
const userName =
(await this.tokenService.getName()) ?? (await this.tokenService.getEmail());
this.color = Utils.stringToColor(userName.toUpperCase());
}
}
} else {
this.color = Utils.stringToColor(this.organizationName.toUpperCase());
}