Browse Source

Fixed issue where included playlists song add/remove didn't update station playlists

Kristian Vos 3 years ago
parent
commit
2732632d0c
1 changed files with 17 additions and 0 deletions
  1. 17 0
      backend/logic/actions/playlists.js

+ 17 - 0
backend/logic/actions/playlists.js

@@ -8,6 +8,7 @@ const DBModule = moduleManager.modules.db;
 const UtilsModule = moduleManager.modules.utils;
 const WSModule = moduleManager.modules.ws;
 const SongsModule = moduleManager.modules.songs;
+const StationsModule = moduleManager.modules.stations;
 const CacheModule = moduleManager.modules.cache;
 const PlaylistsModule = moduleManager.modules.playlists;
 const YouTubeModule = moduleManager.modules.youtube;
@@ -938,6 +939,14 @@ export default {
 					});
 				}
 
+				StationsModule.runJob("GET_STATIONS_THAT_INCLUDE_OR_EXCLUDE_PLAYLIST", { playlistId })
+					.then(response => {
+						response.stationIds.forEach(stationId => {
+							PlaylistsModule.runJob("AUTOFILL_STATION_PLAYLIST", { stationId }).then().catch();
+						});
+					})
+					.catch();
+
 				CacheModule.runJob("PUB", {
 					channel: "playlist.addSong",
 					value: {
@@ -1155,6 +1164,14 @@ export default {
 				},
 
 				(playlist, next) => {
+					StationsModule.runJob("GET_STATIONS_THAT_INCLUDE_OR_EXCLUDE_PLAYLIST", { playlistId })
+						.then(response => {
+							response.stationIds.forEach(stationId => {
+								PlaylistsModule.runJob("AUTOFILL_STATION_PLAYLIST", { stationId }).then().catch();
+							});
+						})
+						.catch();
+
 					SongsModule.runJob("GET_SONG_FROM_ID", { songId }, this)
 						.then(res =>
 							next(null, playlist, {