mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Updated so username won't overflow. Removing username on general leave
This commit is contained in:
@@ -752,7 +752,12 @@ function getNextSong(coll, socket, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function left_channel(coll, guid, short_id, in_list, socket, change) {
|
function left_channel(coll, guid, short_id, in_list, socket, change) {
|
||||||
if(!coll) return;
|
if(!coll) {
|
||||||
|
if(!change) {
|
||||||
|
Functions.remove_name_from_db(guid, name);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
//coll = coll.replace(/ /g,'');
|
//coll = coll.replace(/ /g,'');
|
||||||
db.collection("connected_users").update({"_id": coll}, {$pull: {users: guid}}, function(err, updated) {
|
db.collection("connected_users").update({"_id": coll}, {$pull: {users: guid}}, function(err, updated) {
|
||||||
if(updated.nModified > 0) {
|
if(updated.nModified > 0) {
|
||||||
@@ -767,10 +772,6 @@ function left_channel(coll, guid, short_id, in_list, socket, change) {
|
|||||||
io.to(coll).emit("viewers", new_doc[0].users.length);
|
io.to(coll).emit("viewers", new_doc[0].users.length);
|
||||||
socket.leave(coll);
|
socket.leave(coll);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!change) {
|
|
||||||
Functions.remove_name_from_db(guid, name);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -781,6 +782,9 @@ function left_channel(coll, guid, short_id, in_list, socket, change) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(!change) {
|
||||||
|
Functions.remove_name_from_db(guid, name);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Functions.remove_unique_id(short_id);
|
Functions.remove_unique_id(short_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user