bigbluebutton-Github/bigbluebutton-html5/imports/api/users-settings/server/publishers.js
Pedro Beschorner Marin 4a0882f9f2 fix(userdata): merge breakout room userdata
Avoid using MongoDB to copy breakout room user's userdata. All userdata is
now merged at bbb-web's join API call.
2022-01-19 10:58:13 -03:00

27 lines
945 B
JavaScript

import { Meteor } from 'meteor/meteor';
import UserSettings from '/imports/api/users-settings';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
function userSettings() {
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing UserSettings was requested by unauth connection ${this.connection.id}`);
return UserSettings.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
Logger.debug('Publishing UserSettings', { meetingId, userId });
return UserSettings.find({ meetingId, userId });
}
function publish(...args) {
const boundUserSettings = userSettings.bind(this);
return boundUserSettings(...args);
}
Meteor.publish('users-settings', publish);