Prechádzať zdrojové kódy

fix: remove/add song to playlist would sometimes throw an error if not an official song

Kristian Vos 1 rok pred
rodič
commit
2fc3ebbc11
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      backend/logic/actions/playlists.js

+ 2 - 2
backend/logic/actions/playlists.js

@@ -1243,7 +1243,7 @@ export default {
 					const { _id, youtubeId, title, artists, thumbnail } = newSong;
 					const { likes, dislikes } = ratings;
 
-					SongsModule.runJob("UPDATE_SONG", { songId: _id });
+					if (_id) SongsModule.runJob("UPDATE_SONG", { songId: _id });
 
 					if (playlist.type === "user-liked") {
 						CacheModule.runJob("PUB", {
@@ -1903,7 +1903,7 @@ export default {
 					if (ratings && (playlist.type === "user-liked" || playlist.type === "user-disliked")) {
 						const { likes, dislikes } = ratings;
 
-						SongsModule.runJob("UPDATE_SONG", { songId: _id });
+						if (_id) SongsModule.runJob("UPDATE_SONG", { songId: _id });
 
 						if (playlist.type === "user-liked") {
 							CacheModule.runJob("PUB", {