Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onStartup add defer and default query #163

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading