2022-02-02 21:53:23 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import UsersPersistentData from '/imports/api/users-persistent-data';
|
|
|
|
|
2023-03-10 20:06:13 +08:00
|
|
|
export default async function changeHasConnectionStatus(hasConnectionStatus, userId, meetingId) {
|
2022-02-02 21:53:23 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
'shouldPersist.hasConnectionStatus': hasConnectionStatus,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
2023-03-10 20:06:13 +08:00
|
|
|
const numberAffected = await UsersPersistentData.updateAsync(selector, modifier);
|
2022-02-02 21:53:23 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Changed hasConnectionStatus=${hasConnectionStatus} id=${userId} meeting=${meetingId}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Change hasConnectionStatus error: ${err}`);
|
|
|
|
}
|
|
|
|
}
|