From b871036b069dee6fe3dad29293ffa078fb3e7061 Mon Sep 17 00:00:00 2001 From: jorenn92 Date: Mon, 11 Dec 2023 09:08:56 +0100 Subject: [PATCH] chore(collections): Remove from all collections improvement --- server/src/modules/collections/collections.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/modules/collections/collections.service.ts b/server/src/modules/collections/collections.service.ts index 19ef3c19..66a1aaf4 100644 --- a/server/src/modules/collections/collections.service.ts +++ b/server/src/modules/collections/collections.service.ts @@ -365,7 +365,7 @@ export class CollectionsService { const handleMedia: AddCollectionMedia[] = []; const collection = - collectionDbId !== -1 + collectionDbId !== -1 && collectionDbId !== undefined ? await this.collectionRepo.findOne({ where: { id: collectionDbId }, }) @@ -520,7 +520,11 @@ export class CollectionsService { if (action === 'add') { return this.addToCollection(collectionDbId, handleMedia, true); } else if (action === 'remove') { - return this.removeFromCollection(collectionDbId, handleMedia); + if (collectionDbId) { + return this.removeFromCollection(collectionDbId, handleMedia); + } else { + this.removeFromAllCollections(handleMedia); + } } }