From d7f18bdd8be74f26842695a7ec68bc2a4522d0c2 Mon Sep 17 00:00:00 2001 From: advplyr Date: Mon, 3 Apr 2023 17:41:03 -0500 Subject: [PATCH] Remove deprecated user settings --- server/controllers/MeController.js | 17 ------------- server/objects/user/User.js | 40 ------------------------------ server/routers/ApiRouter.js | 1 - 3 files changed, 58 deletions(-) diff --git a/server/controllers/MeController.js b/server/controllers/MeController.js index 9697ebe7..1cb2ec9a 100644 --- a/server/controllers/MeController.js +++ b/server/controllers/MeController.js @@ -171,23 +171,6 @@ class MeController { this.auth.userChangePassword(req, res) } - // TODO: Remove after mobile release v0.9.61-beta - // PATCH: api/me/settings - async updateSettings(req, res) { - var settingsUpdate = req.body - if (!settingsUpdate || !isObject(settingsUpdate)) { - return res.sendStatus(500) - } - var madeUpdates = req.user.updateSettings(settingsUpdate) - if (madeUpdates) { - await this.db.updateEntity('user', req.user) - } - return res.json({ - success: true, - settings: req.user.settings - }) - } - // TODO: Deprecated. Removed from Android. Only used in iOS app now. // POST: api/me/sync-local-progress async syncLocalMediaProgress(req, res) { diff --git a/server/objects/user/User.js b/server/objects/user/User.js index 461b1855..ed59aca1 100644 --- a/server/objects/user/User.js +++ b/server/objects/user/User.js @@ -18,7 +18,6 @@ class User { this.seriesHideFromContinueListening = [] // Series IDs that should not show on home page continue listening this.bookmarks = [] - this.settings = {} // TODO: Remove after mobile release v0.9.61-beta this.permissions = {} this.librariesAccessible = [] // Library IDs (Empty if ALL libraries) this.itemTagsAccessible = [] // Empty if ALL item tags accessible @@ -59,15 +58,6 @@ class User { return !!this.pash && !!this.pash.length } - // TODO: Remove after mobile release v0.9.61-beta - getDefaultUserSettings() { - return { - mobileOrderBy: 'recent', - mobileOrderDesc: true, - mobileFilterBy: 'all' - } - } - getDefaultUserPermissions() { return { download: true, @@ -94,7 +84,6 @@ class User { isLocked: this.isLocked, lastSeen: this.lastSeen, createdAt: this.createdAt, - settings: this.settings, // TODO: Remove after mobile release v0.9.61-beta permissions: this.permissions, librariesAccessible: [...this.librariesAccessible], itemTagsAccessible: [...this.itemTagsAccessible] @@ -114,7 +103,6 @@ class User { isLocked: this.isLocked, lastSeen: this.lastSeen, createdAt: this.createdAt, - settings: this.settings, // TODO: Remove after mobile release v0.9.61-beta permissions: this.permissions, librariesAccessible: [...this.librariesAccessible], itemTagsAccessible: [...this.itemTagsAccessible] @@ -171,7 +159,6 @@ class User { this.isLocked = user.type === 'root' ? false : !!user.isLocked this.lastSeen = user.lastSeen || null this.createdAt = user.createdAt || Date.now() - this.settings = user.settings || this.getDefaultUserSettings() // TODO: Remove after mobile release v0.9.61-beta this.permissions = user.permissions || this.getDefaultUserPermissions() // Upload permission added v1.1.13, make sure root user has upload permissions if (this.type === 'root' && !this.permissions.upload) this.permissions.upload = true @@ -348,33 +335,6 @@ class User { return true } - // TODO: Remove after mobile release v0.9.61-beta - // Returns Boolean If update was made - updateSettings(settings) { - if (!this.settings) { - this.settings = { ...settings } - return true - } - var madeUpdates = false - - for (const key in this.settings) { - if (settings[key] !== undefined && this.settings[key] !== settings[key]) { - this.settings[key] = settings[key] - madeUpdates = true - } - } - - // Check if new settings update has keys not currently in user settings - for (const key in settings) { - if (settings[key] !== undefined && this.settings[key] === undefined) { - this.settings[key] = settings[key] - madeUpdates = true - } - } - - return madeUpdates - } - checkCanAccessLibrary(libraryId) { if (this.permissions.accessAllLibraries) return true if (!this.librariesAccessible) return false diff --git a/server/routers/ApiRouter.js b/server/routers/ApiRouter.js index 3693ec52..5b37fd5b 100644 --- a/server/routers/ApiRouter.js +++ b/server/routers/ApiRouter.js @@ -174,7 +174,6 @@ class ApiRouter { this.router.patch('/me/item/:id/bookmark', MeController.updateBookmark.bind(this)) this.router.delete('/me/item/:id/bookmark/:time', MeController.removeBookmark.bind(this)) this.router.patch('/me/password', MeController.updatePassword.bind(this)) - this.router.patch('/me/settings', MeController.updateSettings.bind(this)) // TODO: Deprecated. Remove after mobile release v0.9.61-beta this.router.post('/me/sync-local-progress', MeController.syncLocalMediaProgress.bind(this)) // TODO: Deprecated. Removed from Android. Only used in iOS app now. 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))