Prechádzať zdrojové kódy

fix if userId in _meteorSession is undefined

Martin Filser 2 rokov pred
rodič
commit
68610e5066
1 zmenil súbory, kde vykonal 9 pridanie a 10 odobranie
  1. 9 10
      server/publications/users.js

+ 9 - 10
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(),
+            },
+          });
+        }
+      });
     });
 */
   }