2022-01-07 05:07:22 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import Users from '/imports/api/users';
|
|
|
|
|
2023-03-15 21:18:31 +08:00
|
|
|
export default async function userLeftFlagUpdated(meetingId, userId, left) {
|
2022-01-07 05:07:22 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
left,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
2023-03-15 21:18:31 +08:00
|
|
|
const numberAffected = await Users.updateAsync(selector, modifier);
|
2022-01-07 05:07:22 +08:00
|
|
|
if (numberAffected) {
|
2023-02-22 04:47:43 +08:00
|
|
|
Logger.info(`Updated user ${userId} with left flag as ${left} in meeting ${meetingId}`);
|
2022-01-07 05:07:22 +08:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Changed user role: ${err}`);
|
|
|
|
}
|
|
|
|
}
|