ソースを参照

Fixed issues with refactoring.

KrisVos130 8 年 前
コミット
9893de496d
2 ファイル変更4 行追加1 行削除
  1. 1 0
      backend/logic/actions/playlists.js
  2. 3 1
      backend/logic/playlists.js

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

@@ -376,6 +376,7 @@ let lib = {
 	}),*/
 
 	remove: hooks.loginRequired((session, _id, cb, userId) => {
+		console.log(_id, userId);
 		db.models.playlist.remove({ _id, createdBy: userId }).exec(err => {
 			if (err) return cb({ status: 'failure', message: 'Something went wrong when removing the playlist.'});
 			cache.hdel('playlists', _id, () => {

+ 3 - 1
backend/logic/playlists.js

@@ -26,6 +26,7 @@ module.exports = {
 						else if (!playlist) {
 							cache.hdel('playlists', playlistId, next);
 						}
+						else next();
 					});
 				}, next);
 			},
@@ -61,7 +62,7 @@ module.exports = {
 				cache.hgetall('playlists', next);
 			},
 
-			(playlists) => {
+			(playlists, next) => {
 				let playlistIds = Object.keys(playlists);
 				async.each(playlistIds, (playlistId, next) => {
 					db.models.playlist.findOne({_id: playlistId}, (err, playlist) => {
@@ -69,6 +70,7 @@ module.exports = {
 						else if (!playlist) {
 							cache.hdel('playlists', playlistId, next);
 						}
+						else next();
 					});
 				}, next);
 			},