From fa5bdac1be49a0d87e0df01c6413864ade556c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 30 Jan 2018 16:40:38 +0100 Subject: [PATCH] Fixed issue where offline listeners not decreasing when leaving channel --- server/handlers/list.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/handlers/list.js b/server/handlers/list.js index 1154bebc..18aafb37 100644 --- a/server/handlers/list.js +++ b/server/handlers/list.js @@ -506,6 +506,13 @@ function left_channel(coll, guid, short_id, in_list, socket, change) Functions.remove_name_from_db(guid, name); } }); + } else { + db.collection("connected_users").update({"_id": "offline_users"}, {$pull: {users: guid}}, function(err, updated){ + if(updated.nModified > 0) { + db.collection("connected_users").update({"_id": "total_users"}, {$pull: {total_users: guid + coll}}, function(err, updated){}); + } + }); + } }); Functions.remove_unique_id(short_id);