From 68879d20ed7a6dec8872f080ce229ec2540c9720 Mon Sep 17 00:00:00 2001 From: Max Wu Date: Tue, 16 Jan 2018 15:51:24 +0800 Subject: [PATCH] Fix minor typos of wrong parameters passing order and wrong user object indexing in for each function --- lib/realtime.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/realtime.js b/lib/realtime.js index 361bbf09e..e03e2d0bc 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -709,7 +709,7 @@ function connection (socket) { return failConnection(404, 'note id not found', socket) } - if (isDuplicatedInSocketQueue(socket, connectionSocketQueue)) return + if (isDuplicatedInSocketQueue(connectionSocketQueue, socket)) return // store noteId in this socket session socket.noteId = noteId @@ -723,8 +723,8 @@ function connection (socket) { var maxrandomcount = 10 var found = false do { - Object.keys(notes[noteId].users).forEach(function (user) { - if (user.color === color) { + Object.keys(notes[noteId].users).forEach(function (userId) { + if (notes[noteId].users[userId].color === color) { found = true } })