bigbluebutton-Github/bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/changeHasMessages.js

26 lines
633 B
JavaScript
Raw Normal View History

2021-12-11 03:13:26 +08:00
import Logger from '/imports/startup/server/logger';
import UsersPersistentData from '/imports/api/users-persistent-data';
2021-12-11 03:13:26 +08:00
export default function changeHasMessages(hasMessages, userId, meetingId) {
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
2022-02-02 21:53:23 +08:00
'shouldPersist.hasMessages': hasMessages,
2021-12-11 03:13:26 +08:00
},
};
try {
const numberAffected = UsersPersistentData.update(selector, modifier);
2021-12-11 03:13:26 +08:00
if (numberAffected) {
Logger.info(`Changed hasMessages=${hasMessages} id=${userId} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Change hasMessages error: ${err}`);
}
}