bigbluebutton-Github/bigbluebutton-html5/imports/api/common/server/helpers.js
2018-04-12 13:25:54 -03:00

37 lines
792 B
JavaScript
Executable File

import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
const MSG_DIRECT_TYPE = 'DIRECT';
const NODE_USER = 'nodeJSapp';
export const indexOf = [].indexOf || function (item) {
for (let i = 0, l = this.length; i < l; i += 1) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
};
export const skipFlashDirectEvent = fn => (message, ...args) => {
const { envelope } = message;
const { routing } = envelope;
const shouldSkip = routing.msgType === MSG_DIRECT_TYPE && routing.userId !== NODE_USER;
if (shouldSkip) return () => { };
return fn(...args);
};
export const getMultiUserStatus = (meetingId) => {
const data = WhiteboardMultiUser.findOne({ meetingId });
if (data) {
return data.multiUser;
}
return false;
};