Fixed player issue, and viewer issue on new channels

This commit is contained in:
Kasper Rynning-Tønnesen
2018-01-12 13:46:21 +01:00
parent f6e94162cb
commit dbbd518978
4 changed files with 7 additions and 3 deletions

View File

@@ -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){});
});
});

View File

@@ -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);
});
});
}

View File

@@ -2870,6 +2870,7 @@ nav ul li:hover, nav ul li.active {
#player{
pointer-events:none;
margin-top: 7px;
}
.row .col.s12 {

View File

@@ -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);