mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-21 11:35:34 +01:00
[AC-2431] New collection dialog bug (#8648)
* [AC-2431] Add null check for convertToPermission helper * [AC-2431] Only attempt to convertToPermission if collectionId has a value
This commit is contained in:
parent
5f97f4c4a8
commit
2e8d1a2061
@ -101,7 +101,12 @@ export const getPermissionList = (flexibleCollectionsEnabled: boolean): Permissi
|
||||
* for the dropdown in the AccessSelectorComponent
|
||||
* @param value
|
||||
*/
|
||||
export const convertToPermission = (value: CollectionAccessSelectionView) => {
|
||||
export const convertToPermission = (
|
||||
value: CollectionAccessSelectionView | undefined,
|
||||
): CollectionPermission | undefined => {
|
||||
if (value == null) {
|
||||
return undefined;
|
||||
}
|
||||
if (value.manage) {
|
||||
return CollectionPermission.Manage;
|
||||
} else if (value.readOnly) {
|
||||
|
@ -29,9 +29,9 @@ import { CollectionView } from "@bitwarden/common/vault/models/view/collection.v
|
||||
import { BitValidators, DialogService } from "@bitwarden/components";
|
||||
|
||||
import {
|
||||
CollectionAccessSelectionView,
|
||||
GroupService,
|
||||
GroupView,
|
||||
CollectionAccessSelectionView,
|
||||
} from "../../../admin-console/organizations/core";
|
||||
import { PermissionMode } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.component";
|
||||
import {
|
||||
@ -432,7 +432,10 @@ function mapGroupToAccessItemView(group: GroupView, collectionId: string): Acces
|
||||
labelName: group.name,
|
||||
accessAllItems: group.accessAll,
|
||||
readonly: group.accessAll,
|
||||
readonlyPermission: convertToPermission(group.collections.find((gc) => gc.id == collectionId)),
|
||||
readonlyPermission:
|
||||
collectionId != null
|
||||
? convertToPermission(group.collections.find((gc) => gc.id == collectionId))
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@ -456,9 +459,12 @@ function mapUserToAccessItemView(
|
||||
status: user.status,
|
||||
accessAllItems: user.accessAll,
|
||||
readonly: user.accessAll,
|
||||
readonlyPermission: convertToPermission(
|
||||
new CollectionAccessSelectionView(user.collections.find((uc) => uc.id == collectionId)),
|
||||
),
|
||||
readonlyPermission:
|
||||
collectionId != null
|
||||
? convertToPermission(
|
||||
new CollectionAccessSelectionView(user.collections.find((uc) => uc.id == collectionId)),
|
||||
)
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user