Skip to content

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

only add the collection admin to the subcollection

daniel31x13f2cfbf0b10b4
diff --git a/apps/web/lib/api/controllers/collections/postCollection.ts b/apps/web/lib/api/controllers/collections/postCollection.ts
index 92ddebf7..d7d3c470 100644
--- a/apps/web/lib/api/controllers/collections/postCollection.ts
+++ b/apps/web/lib/api/controllers/collections/postCollection.ts
@@ -88,22 +88,21 @@ export default async function postCollection(
color: collection.color,
icon: collection.icon,
iconWeight: collection.iconWeight,
- owner: {
- connect: { id: rootOwnerId },
- },
- createdBy: {
- connect: { id: userId },
- },
- members: {
- create: dedupedUsers
- .filter((u) => u.userId !== rootOwnerId)
- .map((u) => ({
- userId: u.userId,
- canCreate: u.canCreate,
- canUpdate: u.canUpdate,
- canDelete: u.canDelete,
- })),
- },
+ owner: { connect: { id: rootOwnerId } },
+ createdBy: { connect: { id: userId } },
+ members:
+ userId !== rootOwnerId
+ ? {
+ create: [
+ {
+ userId,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ ],
+ }
+ : undefined,
parent: collection.parentId
? { connect: { id: collection.parentId } }
: undefined,