From cfd9a01da7a2e654511899c921461f6781e10914 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 17 Sep 2023 12:40:13 -0500 Subject: [PATCH] Fix:Server crash when removing item from playlist #2115 --- server/controllers/PlaylistController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/controllers/PlaylistController.js b/server/controllers/PlaylistController.js index 16514ef8..c501f287 100644 --- a/server/controllers/PlaylistController.js +++ b/server/controllers/PlaylistController.js @@ -206,7 +206,7 @@ class PlaylistController { await Database.createPlaylistMediaItem(playlistMediaItem) const jsonExpanded = await req.playlist.getOldJsonExpanded() - SocketAuthority.clientEmitter(playlist.userId, 'playlist_updated', jsonExpanded) + SocketAuthority.clientEmitter(jsonExpanded.userId, 'playlist_updated', jsonExpanded) res.json(jsonExpanded) } @@ -376,9 +376,9 @@ class PlaylistController { if (!numMediaItems) { Logger.info(`[PlaylistController] Playlist "${req.playlist.name}" has no more items - removing it`) await req.playlist.destroy() - SocketAuthority.clientEmitter(playlist.userId, 'playlist_removed', jsonExpanded) + SocketAuthority.clientEmitter(jsonExpanded.userId, 'playlist_removed', jsonExpanded) } else { - SocketAuthority.clientEmitter(playlist.userId, 'playlist_updated', jsonExpanded) + SocketAuthority.clientEmitter(jsonExpanded.userId, 'playlist_updated', jsonExpanded) } } res.json(jsonExpanded)