浏览代码

Fixed issues with admin unverified/hidden songs events not working

Kristian Vos 4 年之前
父节点
当前提交
574e7f2d82

+ 2 - 1
backend/logic/actions/apis.js

@@ -143,8 +143,9 @@ export default {
 	 */
 	joinAdminRoom: isAdminRequired((session, page, cb) => {
 		if (
-			page === "queue" ||
+			page === "unverifiedSongs" ||
 			page === "songs" ||
+			page === "hiddenSongs" ||
 			page === "stations" ||
 			page === "reports" ||
 			page === "news" ||

+ 4 - 0
backend/logic/actions/songs.js

@@ -704,6 +704,10 @@ export default {
 					channel: "song.newVerifiedSong",
 					value: song._id
 				});
+				CacheModule.runJob("PUB", {
+					channel: "song.removedUnverifiedSong",
+					value: song._id
+				});
 
 				return cb({
 					status: "success",

+ 1 - 7
backend/logic/stations.js

@@ -631,13 +631,7 @@ class _StationsModule extends CoreClass {
 									return next(null, song);
 								})
 								.catch(err => {
-									if (err.message === "Song not found.") {
-										this.log(
-											"ERROR",
-											`In GET_NEXT_STATION_SONG, attempted to get song "${song._id}", but got the error "Song not found.". Ignoring it for now, but this is not normal.`
-										);
-										next(null, song);
-									} else next(err);
+									next(err);
 								});
 					}
 				],

+ 2 - 2
frontend/src/pages/Admin/tabs/UnverifiedSongs.vue

@@ -94,7 +94,7 @@
 							</button>
 							<button
 								class="button is-success"
-								@click="add(song)"
+								@click="verify(song)"
 							>
 								<i class="material-icons">add</i>
 							</button>
@@ -257,7 +257,7 @@ export default {
 			this.editingSongId = song._id;
 			this.openModal({ sector: "admin", modal: "editSong" });
 		},
-		add(song) {
+		verify(song) {
 			this.socket.dispatch("songs.verify", song.songId, res => {
 				if (res.status === "success")
 					new Toast({ content: res.message, timeout: 2000 });