Duplicative method cleanup (#6431)

This commit is contained in:
Tom Moor
2024-01-25 20:02:17 -08:00
committed by GitHub
parent cab9a1ec96
commit e62c734c41
13 changed files with 87 additions and 122 deletions

View File

@@ -71,32 +71,9 @@ export default class CollectionGroupMembershipsStore extends Store<CollectionGro
id: collectionId,
groupId,
});
const membership = Array.from(this.data.values()).find(
(m) => m.groupId === groupId && m.collectionId === collectionId
);
if (membership) {
this.remove(membership.id);
}
}
@action
removeCollectionMemberships = (collectionId: string) => {
this.data.forEach((membership, key) => {
if (membership.collectionId === collectionId) {
this.remove(key);
}
this.removeAll({
collectionId,
groupId,
});
};
/**
* 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
);
}
}