Skip to content

Commit

Permalink
Merge pull request #649 from jorenn92/Fix/add-remove-media-fixes-1
Browse files Browse the repository at this point in the history
chore(collections): Remove from all collections improvement
  • Loading branch information
jorenn92 authored Dec 11, 2023
2 parents 9a81f31 + b871036 commit 10a4438
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/src/modules/collections/collections.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
})
Expand Down Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 10a4438

Please sign in to comment.