Add ability to hide and unhide series

List of hidden series IDs is stored in user.extraData and hidden series
are filtered out of the query on the server side.
This commit is contained in:
DoctorDalek1963 2025-11-03 22:05:13 +00:00
parent 9b92b5de34
commit e40efee589
No known key found for this signature in database
8 changed files with 133 additions and 0 deletions

View file

@ -421,6 +421,44 @@ class MeController {
res.json(req.user.toOldJSONForBrowser())
}
/**
* GET: /api/me/series/:id/hide
*
* @param {RequestWithUser} req
* @param {Response} res
*/
async hideSeries(req, res) {
if (!(await Database.seriesModel.checkExistsById(req.params.id))) {
Logger.error(`[MeController] hideSeries: Series ${req.params.id} not found`)
return res.sendStatus(404)
}
const hasUpdated = await req.user.hideSeries(req.params.id)
if (hasUpdated) {
SocketAuthority.clientEmitter(req.user.id, 'user_updated', req.user.toOldJSONForBrowser())
}
res.json(req.user.toOldJSONForBrowser())
}
/**
* GET: /api/me/series/:id/unhide
*
* @param {RequestWithUser} req
* @param {Response} res
*/
async unhideSeries(req, res) {
if (!(await Database.seriesModel.checkExistsById(req.params.id))) {
Logger.error(`[MeController] unhideSeries: Series ${req.params.id} not found`)
return res.sendStatus(404)
}
const hasUpdated = await req.user.unhideSeries(req.params.id)
if (hasUpdated) {
SocketAuthority.clientEmitter(req.user.id, 'user_updated', req.user.toOldJSONForBrowser())
}
res.json(req.user.toOldJSONForBrowser())
}
/**
* GET: api/me/progress/:id/remove-from-continue-listening
*

View file

@ -178,6 +178,7 @@ class UserController {
permissions,
bookmarks: [],
extraData: {
hiddenSeries: [],
seriesHideFromContinueListening: []
}
}