1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01: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:
Thomas Avery 2023-02-15 16:30:25 -06:00 committed by GitHub
parent 652cb8214d
commit 65b9ab66d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ import {
} from "rxjs";
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 {
@ -165,21 +166,25 @@ export class AccessSelectorComponent implements OnInit, OnDestroy {
): SelectItemView[] => {
const selectItemsView = potentialGrantees.map((granteeView) => {
let icon: string;
let listName: string;
let listName = granteeView.name;
let labelName = granteeView.name;
if (granteeView.type === "user") {
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") {
icon = this.groupIcon;
listName = granteeView.name;
} else {
} else if (granteeView.type === "serviceAccount") {
icon = this.serviceAccountIcon;
listName = granteeView.name;
}
return {
icon: icon,
id: granteeView.id,
labelName: granteeView.name,
labelName: labelName,
listName: listName,
};
});