mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-20 15:41:33 +01:00
Fix:Server crash deleting user with sessions
This commit is contained in:
1 parent
c643d4cec8
commit
ef82e8b0d0
1 file changed
+13
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user