Browse Source

Only 1 playlist can be included in station sequential play mode now

Owen Diffey 3 years ago
parent
commit
36c39013be
2 changed files with 3 additions and 4 deletions
  1. 2 0
      backend/logic/actions/stations.js
  2. 1 4
      backend/logic/db/index.js

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

@@ -3426,6 +3426,8 @@ export default {
 					if (!station) return next("Station not found.");
 					if (station.includedPlaylists.indexOf(playlistId) !== -1)
 						return next("That playlist is already included.");
+					if (station.playMode === "sequential" && station.includedPlaylists.length > 0)
+						return next("Error: Only 1 playlist can be included in sequential play mode.");
 					return next();
 				},
 

+ 1 - 4
backend/logic/db/index.js

@@ -143,10 +143,7 @@ class _DBModule extends CoreClass {
 
 					this.schemas.user
 						.path("name")
-						.validate(
-							name => isLength(name, 1, 64) && regex.name.test(name),
-							"Invalid name."
-						);
+						.validate(name => isLength(name, 1, 64) && regex.name.test(name), "Invalid name.");
 
 					// Station
 					this.schemas.station