Improved how naming works on join

- XXXX changed name to YYYY doesn't happen if the user already is signed in
- Signs automatically in on frontpage join
This commit is contained in:
Kasper Rynning-Tønnesen
2018-09-01 13:04:40 +02:00
parent 6d361db3ad
commit 47e45c5b19
4 changed files with 35 additions and 7 deletions

View File

@@ -754,7 +754,7 @@ function getNextSong(coll, socket, callback) {
function left_channel(coll, guid, short_id, in_list, socket, change) {
if(!coll) {
if(!change) {
Functions.remove_name_from_db(guid, name);
Functions.remove_name_from_db(guid);
}
return;
}
@@ -772,7 +772,7 @@ function left_channel(coll, guid, short_id, in_list, socket, change) {
io.to(coll).emit("viewers", new_doc[0].users.length);
socket.leave(coll);
if(!change) {
Functions.remove_name_from_db(guid, name);
Functions.remove_name_from_db(guid);
}
});
});
@@ -782,7 +782,7 @@ function left_channel(coll, guid, short_id, in_list, socket, change) {
//if(updated.nModified > 0) {
db.collection("connected_users").update({"_id": "total_users"}, {$pull: {total_users: guid + coll}}, function(err, updated){});
if(!change) {
Functions.remove_name_from_db(guid, name);
Functions.remove_name_from_db(guid);
}
//}
});