Browse Source

fix(Admin/HiddenSongs): verifying a hidden song doesn't remove it from the list

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 3 years ago
parent
commit
9aa58a0f1f

+ 13 - 9
backend/logic/actions/songs.js

@@ -756,15 +756,16 @@ export default {
 				},
 
 				(song, next) => {
+					const oldStatus = song.status;
+
 					song.verifiedBy = session.userId;
 					song.verifiedAt = Date.now();
 					song.status = "verified";
-					song.save(err => {
-						next(err, song);
-					});
+
+					song.save(err => next(err, song, oldStatus));
 				},
 
-				(song, next) => {
+				(song, oldStatus, next) => {
 					song.genres.forEach(genre => {
 						PlaylistsModule.runJob("AUTOFILL_GENRE_PLAYLIST", { genre })
 							.then(() => {})
@@ -772,21 +773,24 @@ export default {
 					});
 
 					SongsModule.runJob("UPDATE_SONG", { songId: song._id });
-
-					next(null, song);
+					next(null, song, oldStatus);
 				}
 			],
-			async (err, song) => {
+			async (err, song, oldStatus) => {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
-
 					this.log("ERROR", "SONGS_VERIFY", `User "${session.userId}" failed to verify song. "${err}"`);
-
 					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "SONGS_VERIFY", `User "${session.userId}" successfully verified song "${songId}".`);
 
+				if (oldStatus === "hidden")
+					CacheModule.runJob("PUB", {
+						channel: "song.removedHiddenSong",
+						value: song._id
+					});
+
 				CacheModule.runJob("PUB", {
 					channel: "song.newVerifiedSong",
 					value: song._id

+ 2 - 2
frontend/src/App.vue

@@ -550,7 +550,7 @@ a {
 	a {
 		display: inline-block;
 		cursor: pointer;
-		color: var(--dark-grey);
+		// color: var(--dark-grey);
 		vertical-align: middle;
 
 		&:hover,
@@ -965,7 +965,7 @@ h4.section-title {
 		i,
 		span {
 			cursor: pointer;
-			color: var(--dark-grey);
+			// color: var(--dark-grey);
 
 			&:hover,
 			&:focus {

+ 8 - 0
frontend/src/components/modals/EditSong/index.vue

@@ -1451,6 +1451,14 @@ export default {
 				display: flex;
 				margin-left: auto;
 				margin-right: 0;
+
+				button,
+				a,
+				span {
+					&:not(:last-child) {
+						margin-right: 5px;
+					}
+				}
 			}
 		}
 	}