diff --git a/app/scenes/CollectionPermissions/components/InputMemberPermissionSelect.tsx b/app/scenes/CollectionPermissions/components/InputMemberPermissionSelect.tsx index 25c82d60b..889e78a52 100644 --- a/app/scenes/CollectionPermissions/components/InputMemberPermissionSelect.tsx +++ b/app/scenes/CollectionPermissions/components/InputMemberPermissionSelect.tsx @@ -27,7 +27,7 @@ export default function InputMemberPermissionSelect( value: CollectionPermission.Admin, }, ]} - ariaLabel={t("Permissions")} + ariaLabel={t("Permission")} labelHidden nude {...props} diff --git a/app/scenes/CollectionPermissions/index.tsx b/app/scenes/CollectionPermissions/index.tsx index e305f4e49..f4bf41358 100644 --- a/app/scenes/CollectionPermissions/index.tsx +++ b/app/scenes/CollectionPermissions/index.tsx @@ -267,8 +267,9 @@ function CollectionPermissions({ collectionId }: Props) { handleRemoveGroup(group)} onUpdate={(permission) => handleUpdateGroup(group, permission)} @@ -285,7 +286,7 @@ function CollectionPermissions({ collectionId }: Props) { handleRemoveUser(item)} onUpdate={(permission) => handleUpdateUser(item, permission)} diff --git a/app/stores/CollectionGroupMembershipsStore.ts b/app/stores/CollectionGroupMembershipsStore.ts index 0b7580871..2a76e8141 100644 --- a/app/stores/CollectionGroupMembershipsStore.ts +++ b/app/stores/CollectionGroupMembershipsStore.ts @@ -87,4 +87,16 @@ export default class CollectionGroupMembershipsStore extends Store + Array.from(this.data.values()).find( + (m) => m.groupId === groupId && m.collectionId === collectionId + ); } diff --git a/app/stores/MembershipsStore.ts b/app/stores/MembershipsStore.ts index 24adf8f15..103f08c25 100644 --- a/app/stores/MembershipsStore.ts +++ b/app/stores/MembershipsStore.ts @@ -91,11 +91,21 @@ export default class MembershipsStore extends Store { 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 + ); } diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 960caa9c8..d060f3054 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -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> ago": "Active <1> ago", "Never signed in": "Never signed in", "Invited": "Invited",