Cap radio seeds to 5, and communicate this in UI, fixes #407

This commit is contained in:
James Barnsley
2019-07-15 12:27:21 +12:00
parent ae853b6de7
commit 518e6158d6
4 changed files with 23 additions and 13 deletions

View File

@ -88355,19 +88355,24 @@ var EditRadio = function (_React$Component) {
return;
}
this.setState({ error_message: null });
var seeds = Object.assign([], this.state.seeds);
var uris = this.state.uri.split(',');
if (uris.length >= 5) {
uris = uris.slice(0, 5);
this.setState({ error_message: 'More than 5 seeds provided, ignoring rest' });
}
for (var i = 0; i < uris.length; i++) {
if (helpers.uriSource(uris[i]) !== 'spotify') {
this.setState({ error_message: 'Non-Spotify URIs not supported' });
return;
}
if (seeds.indexOf(uris[i]) > -1) {
} else if (seeds.indexOf(uris[i]) > -1) {
this.setState({ error_message: 'URI already added' });
} else {
seeds.push(uris[i]);
this.setState({ error_message: null });
}
// Resolve
@ -88405,7 +88410,7 @@ var EditRadio = function (_React$Component) {
var seeds = [];
if (this.state.seeds) {
for (var i = 0; i < this.state.seeds.length; i++) {
for (var i = 0; i < this.state.seeds.length && i < 5; i++) {
var uri = this.state.seeds[i];
if (uri) {
if (helpers.uriType(uri) == 'artist') {

File diff suppressed because one or more lines are too long

View File

@ -100,7 +100,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1562531122";
var build = "1563150035";
var version = "3.39.0";
// Construct the script tag