From 3b8e4ce9527cf5596fc068f21caeca5a16451dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Wed, 18 Oct 2017 17:03:24 +0200 Subject: [PATCH] Fixed issue where name of person skipping not being correctly sent --- server/handlers/list.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/handlers/list.js b/server/handlers/list.js index 81b34f03..447a46dd 100644 --- a/server/handlers/list.js +++ b/server/handlers/list.js @@ -112,7 +112,17 @@ function skip(list, guid, coll, offline, socket) { { List.change_song(coll, error, video_id); socket.emit("toast", "skip"); - io.to(coll).emit('chat', {from: name, msg: " skipped"}); + db.collection("user_names").find({"guid": guid}, function(err, docs) { + if(docs.length == 1) { + db.collection("registered_users").find({"_id": docs[0].name}, function(err, n) { + var icon = false; + if(n.length > 0 && n[0].icon) { + icon = n[0].icon; + } + io.to(coll).emit('chat', {from: docs[0].name, icon: icon, msg: " skipped"}); + }); + } + }); }else if(!Functions.contains(docs[0].skips, guid)){ db.collection(coll).update({views:{$exists:true}}, {$push:{skips:guid}}, function(err, d){ if(frontpage_viewers[0].viewers == 2)