From a5e38d14737ff8d43ed5b12f5f782978961b532c Mon Sep 17 00:00:00 2001 From: advplyr Date: Mon, 18 Nov 2024 07:59:02 -0600 Subject: [PATCH] Fix:Error adding new series if a series has a null title #3622 --- client/components/widgets/SeriesInputWidget.vue | 2 -- server/objects/metadata/BookMetadata.js | 7 ++++++- server/utils/queries/libraryFilters.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/components/widgets/SeriesInputWidget.vue b/client/components/widgets/SeriesInputWidget.vue index e770eed3..1d8b64fe 100644 --- a/client/components/widgets/SeriesInputWidget.vue +++ b/client/components/widgets/SeriesInputWidget.vue @@ -71,8 +71,6 @@ export default { this.showSeriesForm = true }, submitSeriesForm() { - console.log('submit series form', this.value, this.selectedSeries) - if (!this.selectedSeries.name) { this.$toast.error('Must enter a series') return diff --git a/server/objects/metadata/BookMetadata.js b/server/objects/metadata/BookMetadata.js index 6d3dae43..c6192f11 100644 --- a/server/objects/metadata/BookMetadata.js +++ b/server/objects/metadata/BookMetadata.js @@ -29,7 +29,12 @@ class BookMetadata { this.subtitle = metadata.subtitle this.authors = metadata.authors?.map ? metadata.authors.map((a) => ({ ...a })) : [] this.narrators = metadata.narrators ? [...metadata.narrators].filter((n) => n) : [] - this.series = metadata.series?.map ? metadata.series.map((s) => ({ ...s })) : [] + this.series = metadata.series?.map + ? metadata.series.map((s) => ({ + ...s, + name: s.name || 'No Title' + })) + : [] this.genres = metadata.genres ? [...metadata.genres] : [] this.publishedYear = metadata.publishedYear || null this.publishedDate = metadata.publishedDate || null diff --git a/server/utils/queries/libraryFilters.js b/server/utils/queries/libraryFilters.js index be164eb2..bdddde75 100644 --- a/server/utils/queries/libraryFilters.js +++ b/server/utils/queries/libraryFilters.js @@ -662,7 +662,7 @@ module.exports = { }, attributes: ['id', 'name'] }) - series.forEach((s) => data.series.push({ id: s.id, name: s.name })) + series.forEach((s) => data.series.push({ id: s.id, name: s.name || 'No Title' })) const authors = await Database.authorModel.findAll({ where: {