From dbbd518978ffbecd87083920c522ac14288f9b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Fri, 12 Jan 2018 13:46:21 +0100 Subject: [PATCH] Fixed player issue, and viewer issue on new channels --- server/handlers/functions.js | 3 +-- server/handlers/list.js | 3 ++- server/public/assets/css/style.css | 1 + server/public/assets/js/list.js | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/handlers/functions.js b/server/handlers/functions.js index 55b64385..da5b19ee 100644 --- a/server/handlers/functions.js +++ b/server/handlers/functions.js @@ -28,7 +28,7 @@ function check_inlist(coll, guid, socket, offline) { if(!offline && coll != undefined){ db.collection("connected_users").update({"_id": coll}, {$addToSet:{users: guid}}, {upsert: true}, function(err, updated) { - if(updated.nModified > 0) { + if(updated.nModified > 0 || updated.upserted != undefined) { db.collection("connected_users").find({"_id": coll}, function(err, new_doc) { db.collection("frontpage_lists").update({"_id": coll}, {$set: {"viewers": new_doc[0].users.length}}, function(){ if(new_doc[0].users == undefined || new_doc[0].users.length == undefined) { @@ -41,7 +41,6 @@ function check_inlist(coll, guid, socket, offline) socket.broadcast.to(coll).emit('chat', {from: docs[0].name, msg: " joined"}); } }); - db.collection("connected_users").update({"_id": "total_users"}, {$inc: {total_users: 1}}, function(err, docs){}); }); }); diff --git a/server/handlers/list.js b/server/handlers/list.js index 7902903a..b7c8c3f3 100644 --- a/server/handlers/list.js +++ b/server/handlers/list.js @@ -59,7 +59,8 @@ function list(msg, guid, coll, offline, socket) { db.collection(coll).insert(configs, function(err, docs){ socket.join(coll); List.send_list(coll, socket, true, false, true); - db.collection("frontpage_lists").insert({"_id": coll, "count" : 0, "frontpage": true, "accessed": Functions.get_time()}); + db.collection("frontpage_lists").insert({"_id": coll, "count" : 0, "frontpage": true, "accessed": Functions.get_time(), "viewers": 1}); + Functions.check_inlist(coll, guid, socket, offline); }); }); } diff --git a/server/public/assets/css/style.css b/server/public/assets/css/style.css index 9ca9fdf1..c3da645d 100755 --- a/server/public/assets/css/style.css +++ b/server/public/assets/css/style.css @@ -2870,6 +2870,7 @@ nav ul li:hover, nav ul li.active { #player{ pointer-events:none; + margin-top: 7px; } .row .col.s12 { diff --git a/server/public/assets/js/list.js b/server/public/assets/js/list.js index f5d84095..56609d40 100755 --- a/server/public/assets/js/list.js +++ b/server/public/assets/js/list.js @@ -188,6 +188,9 @@ var List = { $(".first_page").css("display", "none"); $(".next_page_hide").css("display","inline-flex"); $(".prev_page_hide").css("display","inline-flex"); + } else { + $(".next_page").css("display", "none"); + $(".last_page").css("display", "none"); } List.dynamicContentPage(-10);