diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue
index 99eb44a1..ce5f84b7 100644
--- a/client/components/app/BookShelfToolbar.vue
+++ b/client/components/app/BookShelfToolbar.vue
@@ -39,6 +39,7 @@
{{ $strings.LabelMarkSeries }} {{ isSeriesFinished ? $strings.LabelNotFinished : $strings.LabelFinished }}
+ Re-Add Series to Continue Listening
@@ -156,6 +157,9 @@ export default {
if (this.isCollectionsPage) return this.$strings.LabelCollections
return ''
},
+ seriesId() {
+ return this.selectedSeries ? this.selectedSeries.id : null
+ },
seriesName() {
return this.selectedSeries ? this.selectedSeries.name : null
},
@@ -169,6 +173,10 @@ export default {
isSeriesFinished() {
return this.seriesProgress && !!this.seriesProgress.isFinished
},
+ isSeriesRemovedFromContinueListening() {
+ if (!this.seriesId) return false
+ return this.$store.getters['user/getIsSeriesRemovedFromContinueListening'](this.seriesId)
+ },
filterBy() {
return this.$store.getters['user/getUserSetting']('filterBy')
},
@@ -201,6 +209,21 @@ export default {
}
},
methods: {
+ reAddSeriesToContinueListening() {
+ this.processingSeries = true
+ this.$axios
+ .$get(`/api/me/series/${this.seriesId}/readd-to-continue-listening`)
+ .then(() => {
+ this.$toast.success('Series re-added to continue listening')
+ })
+ .catch((error) => {
+ console.error('Failed to re-add series to continue listening', error)
+ this.$toast.error('Failed to re-add series to continue listening')
+ })
+ .finally(() => {
+ this.processingSeries = false
+ })
+ },
async matchAllAuthors() {
this.processingAuthors = true
@@ -238,12 +261,13 @@ export default {
.then(() => {
this.$toast.success('Removed library items with issues')
this.$router.push(`/library/${this.currentLibraryId}/bookshelf`)
- this.processingIssues = false
this.$store.dispatch('libraries/fetch', this.currentLibraryId)
})
.catch((error) => {
console.error('Failed to remove library items with issues', error)
this.$toast.error('Failed to remove library items with issues')
+ })
+ .finally(() => {
this.processingIssues = false
})
}
diff --git a/client/store/user.js b/client/store/user.js
index df1f185c..7b57b169 100644
--- a/client/store/user.js
+++ b/client/store/user.js
@@ -56,6 +56,10 @@ export const getters = {
if (!state.user) return false
if (getters.getUserCanAccessAllLibraries) return true
return getters.getLibrariesAccessible.includes(libraryId)
+ },
+ getIsSeriesRemovedFromContinueListening: (state) => (seriesId) => {
+ if (!state.user || !state.user.seriesHideFromContinueListening || !state.user.seriesHideFromContinueListening.length) return false
+ return state.user.seriesHideFromContinueListening.includes(seriesId)
}
}
diff --git a/server/controllers/MeController.js b/server/controllers/MeController.js
index c2efb331..8a4848ee 100644
--- a/server/controllers/MeController.js
+++ b/server/controllers/MeController.js
@@ -293,6 +293,22 @@ class MeController {
res.json(req.user.toJSONForBrowser())
}
+ // GET: api/me/series/:id/readd-to-continue-listening
+ async readdSeriesFromContinueListening(req, res) {
+ const series = this.db.series.find(se => se.id === req.params.id)
+ if (!series) {
+ Logger.error(`[MeController] readdSeriesFromContinueListening: Series ${req.params.id} not found`)
+ return res.sendStatus(404)
+ }
+
+ const hasUpdated = req.user.removeSeriesFromHideFromContinueListening(req.params.id)
+ if (hasUpdated) {
+ await this.db.updateEntity('user', req.user)
+ this.clientEmitter(req.user.id, 'user_updated', req.user.toJSONForBrowser())
+ }
+ res.json(req.user.toJSONForBrowser())
+ }
+
// GET: api/me/progress/:id/remove-from-continue-listening
async removeItemFromContinueListening(req, res) {
const hasUpdated = req.user.removeProgressFromContinueListening(req.params.id)
diff --git a/server/objects/user/User.js b/server/objects/user/User.js
index a164934a..b2db254b 100644
--- a/server/objects/user/User.js
+++ b/server/objects/user/User.js
@@ -434,6 +434,12 @@ class User {
return true
}
+ removeSeriesFromHideFromContinueListening(seriesId) {
+ if (!this.seriesHideFromContinueListening.includes(seriesId)) return false
+ this.seriesHideFromContinueListening = this.seriesHideFromContinueListening.filter(sid => sid !== seriesId)
+ return true
+ }
+
removeProgressFromContinueListening(progressId) {
const progress = this.mediaProgress.find(mp => mp.id === progressId)
if (!progress) return false
diff --git a/server/routers/ApiRouter.js b/server/routers/ApiRouter.js
index 9f6f7abe..3de794ea 100644
--- a/server/routers/ApiRouter.js
+++ b/server/routers/ApiRouter.js
@@ -156,6 +156,7 @@ class ApiRouter {
this.router.post('/me/sync-local-progress', MeController.syncLocalMediaProgress.bind(this))
this.router.get('/me/items-in-progress', MeController.getAllLibraryItemsInProgress.bind(this))
this.router.get('/me/series/:id/remove-from-continue-listening', MeController.removeSeriesFromContinueListening.bind(this))
+ this.router.get('/me/series/:id/readd-to-continue-listening', MeController.readdSeriesFromContinueListening.bind(this))
//
// Backup Routes