bigbluebutton-Github/bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/changeHasMessages.js
2022-02-02 13:53:23 +00:00

26 lines
633 B
JavaScript

import Logger from '/imports/startup/server/logger';
import UsersPersistentData from '/imports/api/users-persistent-data';
export default function changeHasMessages(hasMessages, userId, meetingId) {
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
'shouldPersist.hasMessages': hasMessages,
},
};
try {
const numberAffected = UsersPersistentData.update(selector, modifier);
if (numberAffected) {
Logger.info(`Changed hasMessages=${hasMessages} id=${userId} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Change hasMessages error: ${err}`);
}
}