fix: Missing permission on selector in permissions dialog
This commit is contained in:
@@ -27,7 +27,7 @@ export default function InputMemberPermissionSelect(
|
||||
value: CollectionPermission.Admin,
|
||||
},
|
||||
]}
|
||||
ariaLabel={t("Permissions")}
|
||||
ariaLabel={t("Permission")}
|
||||
labelHidden
|
||||
nude
|
||||
{...props}
|
||||
|
||||
@@ -267,8 +267,9 @@ function CollectionPermissions({ collectionId }: Props) {
|
||||
<CollectionGroupMemberListItem
|
||||
key={group.id}
|
||||
group={group}
|
||||
collectionGroupMembership={collectionGroupMemberships.get(
|
||||
`${group.id}-${collection.id}`
|
||||
collectionGroupMembership={collectionGroupMemberships.find(
|
||||
collection.id,
|
||||
group.id
|
||||
)}
|
||||
onRemove={() => handleRemoveGroup(group)}
|
||||
onUpdate={(permission) => handleUpdateGroup(group, permission)}
|
||||
@@ -285,7 +286,7 @@ function CollectionPermissions({ collectionId }: Props) {
|
||||
<MemberListItem
|
||||
key={item.id}
|
||||
user={item}
|
||||
membership={memberships.get(`${item.id}-${collection.id}`)}
|
||||
membership={memberships.find(collection.id, item.id)}
|
||||
canEdit={item.id !== user.id || user.isAdmin}
|
||||
onRemove={() => handleRemoveUser(item)}
|
||||
onUpdate={(permission) => handleUpdateUser(item, permission)}
|
||||
|
||||
@@ -87,4 +87,16 @@ export default class CollectionGroupMembershipsStore extends Store<CollectionGro
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Find a collection group membership by collectionId and groupId
|
||||
*
|
||||
* @param collectionId The collection ID
|
||||
* @param groupId The group ID
|
||||
* @returns The collection group membership or undefined if not found.
|
||||
*/
|
||||
find = (collectionId: string, groupId: string) =>
|
||||
Array.from(this.data.values()).find(
|
||||
(m) => m.groupId === groupId && m.collectionId === collectionId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,11 +91,21 @@ export default class MembershipsStore extends Store<Membership> {
|
||||
collectionId: string;
|
||||
userId: string;
|
||||
}) => {
|
||||
const membership = Array.from(this.data.values()).find(
|
||||
(m) => m.userId === userId && m.collectionId === collectionId
|
||||
);
|
||||
const membership = this.find(collectionId, userId);
|
||||
if (membership) {
|
||||
this.remove(membership.id);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Find a collection user membership by collectionId and userId
|
||||
*
|
||||
* @param collectionId The collection ID
|
||||
* @param userId The user ID
|
||||
* @returns The collection user membership or undefined if not found.
|
||||
*/
|
||||
find = (collectionId: string, userId: string) =>
|
||||
Array.from(this.data.values()).find(
|
||||
(m) => m.userId === userId && m.collectionId === collectionId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -471,6 +471,7 @@
|
||||
"Search people": "Search people",
|
||||
"No people matching your search": "No people matching your search",
|
||||
"No people left to add": "No people left to add",
|
||||
"Permission": "Permission",
|
||||
"Active <1></1> ago": "Active <1></1> ago",
|
||||
"Never signed in": "Never signed in",
|
||||
"Invited": "Invited",
|
||||
|
||||
Reference in New Issue
Block a user