瀏覽代碼

fix: station/manageStation queue update event conflicts were breaking queue updates

Kristian Vos 2 年之前
父節點
當前提交
0539adb7fc
共有 2 個文件被更改,包括 10 次插入5 次删除
  1. 8 3
      backend/logic/actions/stations.js
  2. 2 2
      frontend/src/components/modals/ManageStation/index.vue

+ 8 - 3
backend/logic/actions/stations.js

@@ -423,7 +423,7 @@ CacheModule.runJob("SUB", {
 
 			WSModule.runJob("EMIT_TO_ROOM", {
 				room: `manage-station.${stationId}`,
-				args: ["event:station.queue.updated", { data: { stationId, queue: station.queue } }]
+				args: ["event:manageStation.queue.updated", { data: { stationId, queue: station.queue } }]
 			});
 		});
 	}
@@ -432,10 +432,15 @@ CacheModule.runJob("SUB", {
 CacheModule.runJob("SUB", {
 	channel: "station.repositionSongInQueue",
 	cb: res => {
-		WSModule.runJob("EMIT_TO_ROOMS", {
-			rooms: [`station.${res.stationId}`, `manage-station.${res.stationId}`],
+		WSModule.runJob("EMIT_TO_ROOM", {
+			room: `station.${res.stationId}`,
 			args: ["event:station.queue.song.repositioned", { data: { song: res.song } }]
 		});
+
+		WSModule.runJob("EMIT_TO_ROOM", {
+			room: `manage-station.${res.stationId}`,
+			args: ["event:manageStation.queue.song.repositioned", { data: { stationId: res.stationId, song: res.song } }]
+		});
 	}
 });
 

+ 2 - 2
frontend/src/components/modals/ManageStation/index.vue

@@ -428,7 +428,7 @@ export default {
 		});
 
 		this.socket.on(
-			"event:station.queue.updated",
+			"event:manageStation.queue.updated",
 			res => {
 				if (res.data.stationId === this.station._id)
 					this.updateSongsList(res.data.queue);
@@ -437,7 +437,7 @@ export default {
 		);
 
 		this.socket.on(
-			"event:station.queue.song.repositioned",
+			"event:manageStation.queue.song.repositioned",
 			res => {
 				if (res.data.stationId === this.station._id)
 					this.repositionSongInList(res.data.song);