bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/changeUserChatLock.js
Daniel Petri Rocha fa0ad14c35
feat(bbb-html5): Ban specific users from the public chat (#20585)
* Initial user lock changes

* Show lock icon
2024-07-17 12:56:33 -04:00

38 lines
912 B
JavaScript

import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings';
import { check } from 'meteor/check';
export default async function changeUserChatLock(meetingId, payload) {
check(meetingId, String);
check(payload, {
userId: String,
isLocked: Boolean,
});
const { userId, isLocked } = payload;
const userSelector = {
meetingId,
userId,
};
const userModifier = {
$set: {
chatLocked: isLocked,
},
};
try {
const { numberAffected } = await Users.upsertAsync(userSelector, userModifier);
if ( numberAffected ) {
Logger.info(`Updated lock settings in meeting ${meetingId}: disablePublicChat=${isLocked}`);
} else {
Logger.info(`Kept lock settings in meeting ${meetingId}`);
}
} catch (err) {
Logger.error(`Changing user chat lock setting: ${err}`);
}
}