fb30b145af
The voice user ejection callback tethered to Meteor's socket disconnection seems broken (since its introduction). The VU selector uses an invalid field (requesterUserId) - so no VU is ever returned. Since I'm unaware of the original goal behind this code and there's already ejections in place in other components (akka-apps, for instance), this is basically a revert of #9888.
27 lines
955 B
JavaScript
27 lines
955 B
JavaScript
import VoiceUsers from '/imports/api/voice-users';
|
|
import { Meteor } from 'meteor/meteor';
|
|
import Logger from '/imports/startup/server/logger';
|
|
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
|
|
|
|
async function voiceUser() {
|
|
const tokenValidation = await AuthTokenValidation
|
|
.findOneAsync({ connectionId: this.connection.id });
|
|
|
|
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
|
|
Logger.warn(`Publishing VoiceUsers was requested by unauth connection ${this.connection.id}`);
|
|
return VoiceUsers.find({ meetingId: '' });
|
|
}
|
|
|
|
const { meetingId, userId: requesterUserId } = tokenValidation;
|
|
Logger.debug('Publishing Voice User', { meetingId, requesterUserId });
|
|
|
|
return VoiceUsers.find({ meetingId });
|
|
}
|
|
|
|
function publish(...args) {
|
|
const boundVoiceUser = voiceUser.bind(this);
|
|
return boundVoiceUser(...args);
|
|
}
|
|
|
|
Meteor.publish('voiceUsers', publish);
|