Refactor handlers inside /phone to the /user folder
This commit is contained in:
parent
99cfdb2062
commit
d07bca00c9
@ -0,0 +1,36 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
export default function handleListeningOnly({ payload }) {
|
||||
const meetingId = payload.meeting_id;
|
||||
const userId = payload.userid;
|
||||
const listenOnly = payload.listen_only;
|
||||
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(listenOnly, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
userId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$set: {
|
||||
'user.listenOnly': listenOnly,
|
||||
},
|
||||
};
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Assigning user listen only status: ${err}`);
|
||||
}
|
||||
|
||||
if (numChanged) {
|
||||
return Logger.info(`Assigned listen only status '${listenOnly}' user=${userId} meeting=${meetingId}`);
|
||||
}
|
||||
};
|
||||
|
||||
return Users.update(selector, modifier, cb);
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
import updateVoiceUser from '../modifiers/updateVoiceUser';
|
||||
|
||||
export default function handleVoiceUpdate({ payload }) {
|
||||
const meetingId = payload.meeting_id;
|
||||
const user = payload.user;
|
||||
|
||||
check(meetingId, String);
|
||||
check(user, Object);
|
||||
|
||||
const voiceUser = user.voiceUser;
|
||||
check(voiceUser, Object);
|
||||
|
||||
const userId = voiceUser.web_userid;
|
||||
check(userId, Object);
|
||||
|
||||
return updateVoiceUser(meetingId, userId, voiceUser);
|
||||
};
|
24
bigbluebutton-html5/imports/api/users/server/modifiers/lockAllViewersMic.js
Executable file
24
bigbluebutton-html5/imports/api/users/server/modifiers/lockAllViewersMic.js
Executable file
@ -0,0 +1,24 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
export default function lockAllViewersMic(meetingId) {
|
||||
const selector = {
|
||||
meetingId,
|
||||
'user.role': 'VIEWER',
|
||||
'user.listenOnly': false,
|
||||
'user.locked': true,
|
||||
'user.voiceUser.joined': true,
|
||||
'user.voiceUser.muted': false,
|
||||
};
|
||||
|
||||
const usersToMute = Users.find(selector).fetch();
|
||||
|
||||
usersToMute.forEach(user =>
|
||||
muteToggle({
|
||||
meetingId,
|
||||
requesterUserId: user.userId,
|
||||
}, userId, true)
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user