Fix for empty list import (#459)

* Fix for empty list import

* Flex on enable also
This commit is contained in:
Kasper Rynning-Tønnesen
2019-01-15 21:11:16 +01:00
committed by GitHub
parent 03ca6a9f77
commit bcd00aa93e
3 changed files with 7 additions and 3 deletions

View File

@@ -180,6 +180,10 @@ function addPlaylist(arr, guid, offline, socket) {
return; return;
} }
var channel = arr.channel;//.replace(/ /g,'').toLowerCase(); var channel = arr.channel;//.replace(/ /g,'').toLowerCase();
if(arr.length == 0 || arr.songs.length == 0) {
socket.emit("toast", "Empty list..");
return;
}
db.collection("frontpage_lists").find({_id: channel}, function(err, fp) { db.collection("frontpage_lists").find({_id: channel}, function(err, fp) {
if(fp.length == 0) { if(fp.length == 0) {
socket.emit("toast", "nolist"); socket.emit("toast", "nolist");
@@ -201,7 +205,7 @@ function addPlaylist(arr, guid, offline, socket) {
var now_playing = false; var now_playing = false;
if(np.length == 0) now_playing = true; if(np.length == 0) now_playing = true;
db.collection(channel + "_settings").find({id: "config"}, function(e, conf) { db.collection(channel + "_settings").find({id: "config"}, function(e, conf) {
if(arr.length == 0) { if(arr.length == 0 || arr.songs.length) {
socket.emit("toast", "Empty list.."); socket.emit("toast", "Empty list..");
return; return;
} }

View File

@@ -425,7 +425,7 @@ var Channel = {
} else { } else {
Helper.log(["Spotify is not authenticated"]); Helper.log(["Spotify is not authenticated"]);
Helper.css(".spotify_authenticated", "display", "none"); Helper.css(".spotify_authenticated", "display", "none");
Helper.css(".spotify_unauthenticated", "display", "block"); Helper.css(".spotify_unauthenticated", "display", "flex");
} }
}, },

View File

@@ -1344,7 +1344,7 @@ function addDynamicListeners() {
access_token_data = {}; access_token_data = {};
Channel.spotify_is_authenticated(false); Channel.spotify_is_authenticated(false);
Helper.css(".spotify_authenticated", "display", "none"); Helper.css(".spotify_authenticated", "display", "none");
Helper.css(".spotify_unauthenticated", "display", "block"); Helper.css(".spotify_unauthenticated", "display", "flex");
}, access_token_data.expires_in * 1000); }, access_token_data.expires_in * 1000);
} else { } else {
access_token_data = {}; access_token_data = {};