From 9ee6eaade97bd133627586e654cc48d668d94266 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 27 Sep 2022 17:48:45 -0500 Subject: [PATCH] Add:Hide series from home page option #919 --- .../components/app/BookShelfCategorized.vue | 20 ++++++++++++ client/components/app/BookShelfToolbar.vue | 32 ++++++++++++++++--- client/components/cards/LazyBookCard.vue | 25 ++++++++++++++- client/pages/library/_library/series/_id.vue | 17 ++++++++-- server/controllers/SeriesController.js | 9 ++++++ server/objects/entities/Series.js | 17 ++++++++++ server/routers/ApiRouter.js | 1 + server/utils/libraryHelpers.js | 2 +- 8 files changed, 114 insertions(+), 9 deletions(-) diff --git a/client/components/app/BookShelfCategorized.vue b/client/components/app/BookShelfCategorized.vue index ceb79237..043faaca 100644 --- a/client/components/app/BookShelfCategorized.vue +++ b/client/components/app/BookShelfCategorized.vue @@ -244,6 +244,24 @@ export default { this.libraryItemUpdated(li) }) }, + seriesUpdated(series) { + if (series.hideFromHome) { + this.shelves.forEach((shelf) => { + if (shelf.type == 'book' && shelf.id == 'continue-series') { + // Filter out series books from continue series shelf + shelf.entities = shelf.entities.filter((ent) => { + if (ent.media.metadata.series && ent.media.metadata.series.id == series.id) return false + return true + }) + } else if (shelf.type == 'series') { + // Filter out series from series shelf + shelf.entities = shelf.entities.filter((ent) => { + return ent.id != series.id + }) + } + }) + } + }, authorUpdated(author) { this.shelves.forEach((shelf) => { if (shelf.type == 'authors') { @@ -270,6 +288,7 @@ export default { this.$store.commit('user/addSettingsListener', { id: 'bookshelf', meth: this.settingsUpdated }) if (this.$root.socket) { + this.$root.socket.on('series_updated', this.seriesUpdated) this.$root.socket.on('author_updated', this.authorUpdated) this.$root.socket.on('author_removed', this.authorRemoved) this.$root.socket.on('item_updated', this.libraryItemUpdated) @@ -285,6 +304,7 @@ export default { this.$store.commit('user/removeSettingsListener', 'bookshelf') if (this.$root.socket) { + this.$root.socket.off('series_updated', this.seriesUpdated) this.$root.socket.off('author_updated', this.authorUpdated) this.$root.socket.off('author_removed', this.authorRemoved) this.$root.socket.off('item_updated', this.libraryItemUpdated) diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue index 96dff6c9..1e41ce14 100644 --- a/client/components/app/BookShelfToolbar.vue +++ b/client/components/app/BookShelfToolbar.vue @@ -21,13 +21,14 @@