Skip to content

Commit

Permalink
Fix:Server crash deleting user with sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Nov 27, 2024
1 parent c643d4c commit ef82e8b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions server/controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ef82e8b

Please sign in to comment.