Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

fix: improperly adding parent collection members into subcollection

9helixb4b6edd618bb
diff --git a/apps/web/lib/api/controllers/collections/postCollection.ts b/apps/web/lib/api/controllers/collections/postCollection.ts
index c6822179..196b7f47 100644
--- a/apps/web/lib/api/controllers/collections/postCollection.ts
+++ b/apps/web/lib/api/controllers/collections/postCollection.ts
@@ -38,8 +38,20 @@ export default async function postCollection(
});
if (findParentCollection) {
- parentCollectionMembers =
- findParentCollection.members as UsersAndCollections[];
+ parentCollectionMembers = (
+ findParentCollection.members as UsersAndCollections[]
+ ).filter((member) => member.userId !== userId);
+
+ if (findParentCollection.ownerId !== userId) {
+ parentCollectionMembers.push({
+ userId: findParentCollection.ownerId,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ } as UsersAndCollections);
+ }
+
+ console.log("Parent collection members:", parentCollectionMembers);
}
const collectionIsAccessible = await getPermission({
userId: userId,