From 68610e50663811e526fd81384d2981706d94869f Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Sat, 4 Feb 2023 02:37:29 +0100 Subject: [PATCH] fix if userId in _meteorSession is undefined --- server/publications/users.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/publications/users.js b/server/publications/users.js index ada6d6e23..fe933edd2 100644 --- a/server/publications/users.js +++ b/server/publications/users.js @@ -117,16 +117,15 @@ I20221023-09:15:09.602(3)? at packages/ddp-server/livedata_server.js:1496:18 // update last connected user date (needed for one of the KPI) Meteor.server.stream_server.open_sockets.forEach( - (socket) => - //console.log('meteor session', socket._meteorSession.userId), - socket !== undefined && - socket._meteorSession?.userId !== null && - Users.update(socket._meteorSession.userId, { - $set: { - lastConnectionDate: new Date(), - }, - }), - ); + (socket) => { + if (socket?._meteorSession?.userId) { + Users.update(socket._meteorSession.userId, { + $set: { + lastConnectionDate: new Date(), + }, + }); + } + }); }); */ }