mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 14:53:33 +00: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:
@@ -47,7 +47,12 @@
|
|||||||
[bitMenuTriggerFor]="accountMenu"
|
[bitMenuTriggerFor]="accountMenu"
|
||||||
class="tw-border-0 tw-bg-transparent tw-text-alt2 tw-opacity-70 hover:tw-opacity-90"
|
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>
|
<i class="bwi bwi-caret-down bwi-sm" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
<bit-menu class="dropdown-menu" #accountMenu>
|
<bit-menu class="dropdown-menu" #accountMenu>
|
||||||
@@ -57,7 +62,7 @@
|
|||||||
*ngIf="name"
|
*ngIf="name"
|
||||||
appStopProp
|
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">
|
<div class="tw-ml-2 tw-block tw-overflow-hidden tw-whitespace-nowrap">
|
||||||
<span>{{ "loggedInAs" | i18n }}</span>
|
<span>{{ "loggedInAs" | i18n }}</span>
|
||||||
<small class="tw-block tw-overflow-hidden tw-whitespace-nowrap tw-text-muted">{{
|
<small class="tw-block tw-overflow-hidden tw-whitespace-nowrap tw-text-muted">{{
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<div class="mb-3">
|
<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
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-outline-secondary tw-ml-3.5"
|
class="btn btn-outline-secondary tw-ml-3.5"
|
||||||
|
|||||||
@@ -33,10 +33,15 @@ export class OrganizationNameBadgeComponent implements OnInit {
|
|||||||
if (this.isMe) {
|
if (this.isMe) {
|
||||||
this.color = await this.avatarService.loadColorFromState();
|
this.color = await this.avatarService.loadColorFromState();
|
||||||
if (this.color == null) {
|
if (this.color == null) {
|
||||||
|
const userId = await this.tokenService.getUserId();
|
||||||
|
if (userId != null) {
|
||||||
|
this.color = Utils.stringToColor(userId);
|
||||||
|
} else {
|
||||||
const userName =
|
const userName =
|
||||||
(await this.tokenService.getName()) ?? (await this.tokenService.getEmail());
|
(await this.tokenService.getName()) ?? (await this.tokenService.getEmail());
|
||||||
this.color = Utils.stringToColor(userName.toUpperCase());
|
this.color = Utils.stringToColor(userName.toUpperCase());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.color = Utils.stringToColor(this.organizationName.toUpperCase());
|
this.color = Utils.stringToColor(this.organizationName.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user