From 66ccf298ba813c452bd25c1604f9338b8f4b9404 Mon Sep 17 00:00:00 2001 From: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Date: Sat, 7 Oct 2023 22:42:08 +0200 Subject: [PATCH] fix library deletion actually deleting assets (#4386) --- server/src/domain/library/library.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/domain/library/library.service.ts b/server/src/domain/library/library.service.ts index cba40275e7..3c0ab2829b 100644 --- a/server/src/domain/library/library.service.ts +++ b/server/src/domain/library/library.service.ts @@ -137,14 +137,16 @@ export class LibraryService { } // TODO use pagination - const assetIds = await this.repository.getAssetIds(job.id); + const assetIds = await this.repository.getAssetIds(job.id, true); this.logger.debug(`Will delete ${assetIds.length} asset(s) in library ${job.id}`); for (const assetId of assetIds) { await this.jobRepository.queue({ name: JobName.ASSET_DELETION, data: { id: assetId, fromExternal: true } }); } - this.logger.log(`Deleting library ${job.id}`); - await this.repository.delete(job.id); + if (assetIds.length === 0) { + this.logger.log(`Deleting library ${job.id}`); + await this.repository.delete(job.id); + } return true; }