From 6ddb69e1eaba40693cc9d5330cbe157dea78a4b6 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 16 May 2021 18:55:07 +0200 Subject: [PATCH] Server: Fixed bug when unsharing a notebook that has no recipients --- packages/server/src/models/ShareUserModel.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/server/src/models/ShareUserModel.ts b/packages/server/src/models/ShareUserModel.ts index b73ce3b58..7a0615f31 100644 --- a/packages/server/src/models/ShareUserModel.ts +++ b/packages/server/src/models/ShareUserModel.ts @@ -131,6 +131,7 @@ export default class ShareUserModel extends BaseModel { if (share.type !== ShareType.Folder) return; const shareUsers = await this.byShareId(share.id, null); + if (!shareUsers.length) return; await this.withTransaction(async () => { await this.delete(shareUsers.map(s => s.id));