mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
[SM-502] Fix empty user name in multi selector (#4752)
* Fix empty user name in multi selector * Use Utils for null check
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
|||||||
} from "rxjs";
|
} from "rxjs";
|
||||||
|
|
||||||
import { ValidationService } from "@bitwarden/common/abstractions/validation.service";
|
import { ValidationService } from "@bitwarden/common/abstractions/validation.service";
|
||||||
|
import { Utils } from "@bitwarden/common/misc/utils";
|
||||||
import { SelectItemView } from "@bitwarden/components/src/multi-select/models/select-item-view";
|
import { SelectItemView } from "@bitwarden/components/src/multi-select/models/select-item-view";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -165,21 +166,25 @@ export class AccessSelectorComponent implements OnInit, OnDestroy {
|
|||||||
): SelectItemView[] => {
|
): SelectItemView[] => {
|
||||||
const selectItemsView = potentialGrantees.map((granteeView) => {
|
const selectItemsView = potentialGrantees.map((granteeView) => {
|
||||||
let icon: string;
|
let icon: string;
|
||||||
let listName: string;
|
let listName = granteeView.name;
|
||||||
|
let labelName = granteeView.name;
|
||||||
if (granteeView.type === "user") {
|
if (granteeView.type === "user") {
|
||||||
icon = this.userIcon;
|
icon = this.userIcon;
|
||||||
listName = `${granteeView.name} (${granteeView.email})`;
|
if (Utils.isNullOrWhitespace(granteeView.name)) {
|
||||||
|
listName = granteeView.email;
|
||||||
|
labelName = granteeView.email;
|
||||||
|
} else {
|
||||||
|
listName = `${granteeView.name} (${granteeView.email})`;
|
||||||
|
}
|
||||||
} else if (granteeView.type === "group") {
|
} else if (granteeView.type === "group") {
|
||||||
icon = this.groupIcon;
|
icon = this.groupIcon;
|
||||||
listName = granteeView.name;
|
} else if (granteeView.type === "serviceAccount") {
|
||||||
} else {
|
|
||||||
icon = this.serviceAccountIcon;
|
icon = this.serviceAccountIcon;
|
||||||
listName = granteeView.name;
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
icon: icon,
|
icon: icon,
|
||||||
id: granteeView.id,
|
id: granteeView.id,
|
||||||
labelName: granteeView.name,
|
labelName: labelName,
|
||||||
listName: listName,
|
listName: listName,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user