Sanitize: set default subgenre where applicable
This commit is contained in:
parent
bfe28315a0
commit
178059dc19
|
@ -50,11 +50,12 @@ async function sanitizeDiscoverParams(params) {
|
||||||
};
|
};
|
||||||
if (sanitized.sortBy !== 'rec') {
|
if (sanitized.sortBy !== 'rec') {
|
||||||
// following only valid when sortBy is not 'rec' (artist-recommend)
|
// following only valid when sortBy is not 'rec' (artist-recommend)
|
||||||
if (params.subgenre !== undefined && getOptionValue(options.subgenres[sanitized.genre], params.subgenre) !== null) {
|
const subgenreOptions = options.subgenres[sanitized.genre];
|
||||||
sanitized.subgenre = params.subgenre;
|
if (subgenreOptions) { // false if genre is 'all'
|
||||||
|
sanitized.subgenre = getOptionValue(subgenreOptions, params.subgenre);
|
||||||
}
|
}
|
||||||
if (sanitized.subgenre === undefined) {
|
const timeAllowed = sanitized.subgenre === undefined || sanitized.subgenre === subgenreOptions[0].value;
|
||||||
// 'time' only valid when 'subgenre' is not set
|
if (timeAllowed) {
|
||||||
sanitized.time = getOptionValue(options.times, params.time);
|
sanitized.time = getOptionValue(options.times, params.time);
|
||||||
}
|
}
|
||||||
sanitized.location = getOptionValue(options.locations, params.location);
|
sanitized.location = getOptionValue(options.locations, params.location);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user