浏览代码

fix: User not removed as DJ from station on deletion

Owen Diffey 2 年之前
父节点
当前提交
157601c2d9
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      backend/logic/actions/users.js

+ 10 - 0
backend/logic/actions/users.js

@@ -380,7 +380,12 @@ export default {
 					});
 				},
 
+				// remove user as station DJ
 				next => {
+					stationModel.updateMany({ djs: session.userId }, { $pull: { djs: session.userId } }, next);
+				},
+
+				(res, next) => {
 					playlistModel.findOne({ createdBy: session.userId, type: "user-liked" }, next);
 				},
 
@@ -606,7 +611,12 @@ export default {
 					});
 				},
 
+				// remove user as station DJ
 				next => {
+					stationModel.updateMany({ djs: userId }, { $pull: { djs: userId } }, next);
+				},
+
+				(res, next) => {
 					playlistModel.findOne({ createdBy: userId, type: "user-liked" }, next);
 				},