Przeglądaj źródła

Fixed Disliked songs not auto skipping regardless of user preference

Owen Diffey 3 lat temu
rodzic
commit
1f7dba2ad6

+ 1 - 1
README.md

@@ -39,7 +39,7 @@ We currently only utilize 1 backend, 1 MongoDB server and 1 Redis server running
 3. `cp backend/config/template.json backend/config/default.json`
 
     | Property | Description |
-    | - | - |
+    | --- | --- |
     | `mode` | Should be either `development` or `production`. No more explanation needed. |
     | `secret` | Whatever you want - used by express's session module. |
     | `domain` | Should be the url where the site will be accessible from,usually `http://localhost` for non-Docker. |

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

@@ -1529,8 +1529,7 @@ export default {
 
 				(station, next) => {
 					if (!station) return next("Station not found.");
-					if (station.theme === newTheme)
-						return next("No change in theme.");
+					if (station.theme === newTheme) return next("No change in theme.");
 					return stationModel.updateOne(
 						{ _id: stationId },
 						{ $set: { theme: newTheme } },

+ 1 - 1
backend/logic/db/schemas/station.js

@@ -45,5 +45,5 @@ export default {
 	owner: { type: String },
 	privatePlaylist: { type: mongoose.Schema.Types.ObjectId },
 	partyMode: { type: Boolean },
-	theme: { type: String, enum: ["blue", "purple", "teal"], default: "blue" }
+	theme: { type: String, enum: ["blue", "purple", "teal", "orange"], default: "blue" }
 };

+ 1 - 9
frontend/src/App.vue

@@ -84,11 +84,6 @@ export default {
 
 		if (nightmode) this.enableNightMode();
 		else this.disableNightMode();
-
-		const autoSkipDisliked =
-			true || JSON.parse(localStorage.getItem("autoSkipDisliked"));
-
-		this.changeAutoSkipDisliked(autoSkipDisliked);
 	},
 	mounted() {
 		document.onkeydown = ev => {
@@ -178,10 +173,7 @@ export default {
 				.classList.remove("night-mode");
 		},
 		...mapActions("modals", ["closeCurrentModal"]),
-		...mapActions("user/preferences", [
-			"changeNightmode",
-			"changeAutoSkipDisliked"
-		])
+		...mapActions("user/preferences", ["changeNightmode"])
 	}
 };
 </script>

+ 0 - 3
frontend/src/components/layout/MainHeader.vue

@@ -182,9 +182,6 @@ export default {
 			color: $white;
 		}
 	}
-	.admin strong {
-		color: #9d42b1;
-	}
 }
 .grouped {
 	margin: 0;

+ 13 - 0
frontend/src/components/modals/EditStation.vue

@@ -441,6 +441,19 @@
 									Teal
 								</button>
 							</transition>
+							<transition name="slide-down">
+								<button
+									class="orange"
+									v-if="
+										themeDropdownActive &&
+											editing.theme !== 'orange'
+									"
+									@click="updateThemeLocal('orange')"
+								>
+									<i class="material-icons">palette</i>
+									Orange
+								</button>
+							</transition>
 						</div>
 					</div>
 				</div>

+ 5 - 0
frontend/src/pages/Home/index.vue

@@ -334,6 +334,8 @@ export default {
 							station.themeCode = "rgb(143, 40, 140)";
 						} else if (theme === "teal") {
 							station.themeCode = "rgb(0, 209, 178)";
+						} else if (theme === "orange") {
+							station.themeCode = "rgb(255, 94, 0)";
 						} else {
 							station.themeCode = "rgb(2, 166, 242)";
 						}
@@ -422,6 +424,8 @@ export default {
 							modifiableStation.themeCode = "rgb(143, 40, 140)";
 						} else if (modifiableStation.theme === "teal") {
 							modifiableStation.themeCode = "rgb(0, 209, 178)";
+						} else if (modifiableStation.theme === "orange") {
+							modifiableStation.themeCode = "rgb(255, 94, 0)";
 						} else {
 							modifiableStation.themeCode = "rgb(2, 166, 242)";
 						}
@@ -607,6 +611,7 @@ html {
 	margin: 10px;
 	cursor: pointer;
 	height: 480px;
+	border-radius: 5px;
 	box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
 	transition: all ease-in-out 0.2s;
 

+ 14 - 2
frontend/src/pages/Station/index.vue

@@ -434,9 +434,16 @@ export default {
 		...mapState({
 			loggedIn: state => state.user.auth.loggedIn,
 			userId: state => state.user.auth.userId,
-			role: state => state.user.auth.role
+			role: state => state.user.auth.role,
+			autoSkipDisliked: state => state.user.preferences.autoSkipDisliked
 		})
 	},
+	beforeMount() {
+		const autoSkipDisliked =
+			true || JSON.parse(localStorage.getItem("autoSkipDisliked"));
+
+		this.changeAutoSkipDisliked(autoSkipDisliked);
+	},
 	mounted() {
 		window.scrollTo(0, 0);
 
@@ -623,6 +630,8 @@ export default {
 					this.theme = "rgb(143, 40, 140)";
 				} else if (theme === "teal") {
 					this.theme = "rgb(0, 209, 178)";
+				} else if (theme === "orange") {
+					this.theme = "rgb(255, 94, 0)";
 				}
 			});
 
@@ -1281,6 +1290,8 @@ export default {
 						this.theme = "rgb(143, 40, 140)";
 					} else if (this.station.theme === "teal") {
 						this.theme = "rgb(0, 209, 178)";
+					} else if (this.station.theme === "orange") {
+						this.theme = "rgb(255, 94, 0)";
 					}
 
 					const currentSong = res.data.currentSong
@@ -1498,7 +1509,8 @@ export default {
 			"editStation",
 			"updateIfStationIsFavorited"
 		]),
-		...mapActions("editSongModal", ["stopVideo"])
+		...mapActions("editSongModal", ["stopVideo"]),
+		...mapActions("user/preferences", ["changeAutoSkipDisliked"])
 	}
 };
 </script>