Skip to content

Commit

Permalink
Merge pull request #163 from Sergeant61/master
Browse files Browse the repository at this point in the history
onStartup add defer and default query
  • Loading branch information
StorytellerCZ authored Jul 16, 2024
2 parents 010845d + d6c8b97 commit 680958a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions server/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ statusEvents.on('connectionActive', async (advice) => {
// Reset online status on startup (users will reconnect)
const onStartup = async (selector) => {
if (selector == null) {
selector = Meteor?.settings?.packages?.['mizzao:user-status']?.startupQuerySelector || {};
selector = Meteor?.settings?.packages?.['mizzao:user-status']?.startupQuerySelector || { 'status.online': true };
}
return await Meteor.users.updateAsync(selector, {
$set: {
Expand All @@ -145,8 +145,17 @@ const onStartup = async (selector) => {
'status.idle': null,
'status.lastActivity': null
}
}, {
multi: true
return Meteor.users.update(selector, {
$set: {
'status.online': false
},
$unset: {
'status.idle': null,
'status.lastActivity': null
}
}, {
multi: true
});
});
};

Expand Down

0 comments on commit 680958a

Please sign in to comment.