diff --git a/server/controllers/UserController.js b/server/controllers/UserController.js index f895c0d0..0fb10513 100644 --- a/server/controllers/UserController.js +++ b/server/controllers/UserController.js @@ -368,6 +368,19 @@ class UserController { await playlist.destroy() } + // Set PlaybackSessions userId to null + const [sessionsUpdated] = await Database.playbackSessionModel.update( + { + userId: null + }, + { + where: { + userId: user.id + } + } + ) + Logger.info(`[UserController] Updated ${sessionsUpdated} playback sessions to remove user id`) + const userJson = user.toOldJSONForBrowser() await user.destroy() SocketAuthority.adminEmitter('user_removed', userJson)