From 653db18679d06b4e0104d52c9149983c51613139 Mon Sep 17 00:00:00 2001 From: Tiberiu Ichim Date: Fri, 6 Feb 2026 22:43:24 +0200 Subject: [PATCH] Fix multiple bugs --- artifacts/2026-02-06/move-to-library-specification.md | 9 +++++++++ client/components/app/BookShelfCategorized.vue | 2 ++ client/components/app/LazyBookshelf.vue | 2 ++ client/components/modals/item/MoveToLibraryModal.vue | 9 +++++---- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/artifacts/2026-02-06/move-to-library-specification.md b/artifacts/2026-02-06/move-to-library-specification.md index 6326a61bb..31b59fd26 100644 --- a/artifacts/2026-02-06/move-to-library-specification.md +++ b/artifacts/2026-02-06/move-to-library-specification.md @@ -72,6 +72,8 @@ POST /api/items/batch/move | `client/pages/item/_id/index.vue` | Single item page context menu integration | | `client/layouts/default.vue` | Modal registration | | `client/strings/en-us.json` | Localization strings | +| `client/components/app/LazyBookshelf.vue` | Enhanced selection payload (added libraryId) | +| `client/components/app/BookShelfCategorized.vue` | Enhanced selection payload (added libraryId) | ### Localization Strings Added @@ -160,6 +162,13 @@ Following the initial implementation, several critical areas were improved: - **Issue**: Nested paths like `media.coverPath` and `libraryFiles.metadata.relPath` were not being updated during moves. - **Fix**: Improved `handleMoveLibraryItem` to perform recursive path replacement on all associated metadata objects. +### 8. Improved Library Picker Filtering - FIXED +- **Issue**: The "Move to Library" dialog showed all libraries of the same type, including the source library itself, which was redundant and confusing. +- **Fix**: + - Updated selection logic in `LazyBookshelf.vue` and `BookShelfCategorized.vue` to include the source `libraryId` in the selection payload. + - Refactored `MoveToLibraryModal.vue` to compare the source library with available targets and automatically omit the source from the dropdown list. + - Added robust media type detection in the modal to ensure compatibility even when items are moved from mixed-content views like search results. + --- ## Known Limitations / Future Work diff --git a/client/components/app/BookShelfCategorized.vue b/client/components/app/BookShelfCategorized.vue index 4bf8cfbbf..52ab20123 100644 --- a/client/components/app/BookShelfCategorized.vue +++ b/client/components/app/BookShelfCategorized.vue @@ -135,6 +135,7 @@ export default { if (thisEntity) { const mediaItem = { id: thisEntity.id, + libraryId: thisEntity.libraryId, mediaType: thisEntity.mediaType, hasTracks: thisEntity.mediaType === 'podcast' || thisEntity.media.audioFile || thisEntity.media.numTracks || (thisEntity.media.tracks && thisEntity.media.tracks.length) } @@ -146,6 +147,7 @@ export default { } else { const mediaItem = { id: entity.id, + libraryId: entity.libraryId, mediaType: entity.mediaType, hasTracks: entity.mediaType === 'podcast' || entity.media.audioFile || entity.media.numTracks || (entity.media.tracks && entity.media.tracks.length) } diff --git a/client/components/app/LazyBookshelf.vue b/client/components/app/LazyBookshelf.vue index 4c72d0d78..d1be0d8c3 100644 --- a/client/components/app/LazyBookshelf.vue +++ b/client/components/app/LazyBookshelf.vue @@ -293,6 +293,7 @@ export default { const mediaItem = { id: thisEntity.id, + libraryId: thisEntity.libraryId, mediaType: thisEntity.mediaType, hasTracks: thisEntity.mediaType === 'podcast' || thisEntity.media.audioFile || thisEntity.media.numTracks || (thisEntity.media.tracks && thisEntity.media.tracks.length) } @@ -304,6 +305,7 @@ export default { } else { const mediaItem = { id: entity.id, + libraryId: entity.libraryId, mediaType: entity.mediaType, hasTracks: entity.mediaType === 'podcast' || entity.media.audioFile || entity.media.numTracks || (entity.media.tracks && entity.media.tracks.length) } diff --git a/client/components/modals/item/MoveToLibraryModal.vue b/client/components/modals/item/MoveToLibraryModal.vue index 3868e04da..29b4be95c 100644 --- a/client/components/modals/item/MoveToLibraryModal.vue +++ b/client/components/modals/item/MoveToLibraryModal.vue @@ -97,12 +97,13 @@ export default { if (this.isBatchMode && this.selectedItems.length > 0) { return this.selectedItems[0].libraryId } - return this.libraryItem?.libraryId + return this.libraryItem?.libraryId || this.$store.state.libraries.currentLibraryId }, currentMediaType() { - // Get media type from the current library - const currentLibrary = this.$store.state.libraries.libraries.find((l) => l.id === this.currentLibraryId) - return currentLibrary?.mediaType || 'book' + if (this.isBatchMode && this.selectedItems.length > 0) { + return this.selectedItems[0].mediaType + } + return this.libraryItem?.mediaType || 'book' }, targetLibraries() { // Filter libraries to only show compatible ones (same media type, different library)