Merge branch 'bbb-2x-mconf' of github.com:bigbluebutton/bigbluebutton into bbb-2x-mconf
This commit is contained in:
commit
12021fb451
@ -1,12 +1,10 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis2x';
|
||||
import handleCreateBreakout from './handlers/createBreakout';
|
||||
import handleBreakoutJoinURL from './handlers/breakoutJoinURL';
|
||||
import handleBreakoutStarted from './handlers/breakoutStarted';
|
||||
import handleUpdateTimeRemaining from './handlers/updateTimeRemaining';
|
||||
import handleBreakoutClosed from './handlers/breakoutClosed';
|
||||
|
||||
RedisPubSub.on('CreateBreakoutRoomEvtMsg', handleCreateBreakout);
|
||||
RedisPubSub.on('BreakoutRoomStartedEvtMsg', handleBreakoutStarted);
|
||||
RedisPubSub.on('BreakoutRoomJoinURLEvtMsg', handleBreakoutJoinURL);
|
||||
RedisPubSub.on('BreakoutRoomsTimeRemainingUpdateEvtMsg', handleUpdateTimeRemaining);
|
||||
RedisPubSub.on('EndBreakoutRoomEvtMsg', handleBreakoutClosed);
|
||||
RedisPubSub.on('BreakoutRoomEndedEvtMsg', handleBreakoutClosed);
|
||||
|
@ -2,9 +2,9 @@ import { check } from 'meteor/check';
|
||||
import clearBreakouts from '../modifiers/clearBreakouts';
|
||||
|
||||
export default function handleBreakoutClosed({ body }) {
|
||||
const { breakoutMeetingId } = body;
|
||||
const { breakoutId } = body;
|
||||
|
||||
check(breakoutMeetingId, String);
|
||||
check(breakoutId, String);
|
||||
|
||||
return clearBreakouts(breakoutMeetingId);
|
||||
return clearBreakouts(breakoutId);
|
||||
}
|
||||
|
@ -12,10 +12,12 @@ const getUrlParams = (urlToParse) => {
|
||||
return parsedUrl.query;
|
||||
};
|
||||
|
||||
|
||||
export default function handleBreakoutJoinURL({ body }) {
|
||||
const {
|
||||
noRedirectJoinURL,
|
||||
userId,
|
||||
breakoutId,
|
||||
} = body;
|
||||
|
||||
check(noRedirectJoinURL, String);
|
||||
@ -23,18 +25,17 @@ export default function handleBreakoutJoinURL({ body }) {
|
||||
const urlParams = getUrlParams(noRedirectJoinURL);
|
||||
|
||||
const selector = {
|
||||
externalMeetingId: urlParams.meetingID,
|
||||
breakoutId,
|
||||
};
|
||||
|
||||
let breakout = Breakouts.findOne(selector);
|
||||
|
||||
const res = Meteor.http.call('get', noRedirectJoinURL);
|
||||
|
||||
xmlParser.parseString(res.content, (err, parsedXML) => {
|
||||
if (err) {
|
||||
return Logger.error(`An Error occured when parsing xml response for: ${noRedirectJoinURL}`);
|
||||
}
|
||||
|
||||
breakout = Breakouts.findOne(selector);
|
||||
const breakout = Breakouts.findOne(selector);
|
||||
|
||||
const { response } = parsedXML;
|
||||
const users = breakout.users;
|
||||
@ -45,6 +46,7 @@ export default function handleBreakoutJoinURL({ body }) {
|
||||
meetingId: response.meeting_id[0],
|
||||
userId: response.user_id[0],
|
||||
authToken: response.auth_token[0],
|
||||
sessionToken: response.session_token[0],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1,27 +1,31 @@
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { check } from 'meteor/check';
|
||||
import flat from 'flat';
|
||||
|
||||
export default function handleBreakoutRoomStarted({ body }) {
|
||||
export default function handleBreakoutRoomStarted({ body }, meetingId) {
|
||||
const {
|
||||
meetingId,
|
||||
externalMeetingId,
|
||||
} = body.breakout;
|
||||
parentMeetingId,
|
||||
breakout,
|
||||
} = body;
|
||||
|
||||
const { breakoutId } = breakout;
|
||||
|
||||
const timeRemaining = 15;
|
||||
|
||||
check(meetingId, String);
|
||||
|
||||
const selector = {
|
||||
breakoutMeetingId: meetingId,
|
||||
breakoutId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$set: {
|
||||
users: [],
|
||||
timeRemaining: Number(timeRemaining),
|
||||
externalMeetingId,
|
||||
},
|
||||
$set: Object.assign(
|
||||
{ users: [] },
|
||||
{ timeRemaining: Number(timeRemaining) },
|
||||
{ parentMeetingId },
|
||||
flat(breakout),
|
||||
),
|
||||
};
|
||||
|
||||
const cb = (err) => {
|
||||
@ -30,8 +34,8 @@ export default function handleBreakoutRoomStarted({ body }) {
|
||||
}
|
||||
|
||||
return Logger.info('Updated timeRemaining and externalMeetingId ' +
|
||||
`for breakout id=${meetingId}`);
|
||||
`for breakout id=${breakoutId}`);
|
||||
};
|
||||
|
||||
return Breakouts.update(selector, modifier, cb);
|
||||
return Breakouts.upsert(selector, modifier, cb);
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
import { check } from 'meteor/check';
|
||||
import addBreakout from '../modifiers/addBreakout';
|
||||
|
||||
export default function handleCreateBreakout({ body }) {
|
||||
const { breakoutMeetingId } = body.room;
|
||||
|
||||
check(breakoutMeetingId, String);
|
||||
|
||||
return addBreakout(body.room);
|
||||
}
|
@ -2,9 +2,8 @@ import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
|
||||
export default function handleUpdateTimeRemaining({ body }) {
|
||||
export default function handleUpdateTimeRemaining({ body }, meetingId) {
|
||||
const {
|
||||
meetingId,
|
||||
timeRemaining,
|
||||
} = body;
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
import flat from 'flat';
|
||||
|
||||
export default function addBreakout(breakout) {
|
||||
const {
|
||||
breakoutMeetingId,
|
||||
parentId,
|
||||
name,
|
||||
} = breakout;
|
||||
|
||||
check(breakoutMeetingId, String);
|
||||
check(parentId, String);
|
||||
check(name, String);
|
||||
|
||||
const selector = { breakoutMeetingId };
|
||||
|
||||
const modifier = {
|
||||
$set:
|
||||
flat(breakout, { safe: true }),
|
||||
};
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding breakout to collection: ${err}`);
|
||||
}
|
||||
|
||||
const {
|
||||
insertedId,
|
||||
} = numChanged;
|
||||
if (insertedId) {
|
||||
return Logger.info(`Added breakout id=${breakoutMeetingId}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted breakout id=${breakoutMeetingId}`);
|
||||
};
|
||||
|
||||
return Breakouts.upsert(selector, modifier, cb);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
|
||||
export default function clearBreakouts(breakoutMeetingId) {
|
||||
if (breakoutMeetingId) {
|
||||
export default function clearBreakouts(breakoutId) {
|
||||
if (breakoutId) {
|
||||
const selector = {
|
||||
breakoutMeetingId,
|
||||
breakoutId,
|
||||
};
|
||||
|
||||
return Breakouts.remove(selector);
|
||||
|
@ -13,7 +13,8 @@ function breakouts(credentials) {
|
||||
|
||||
return Breakouts.find({
|
||||
$or: [
|
||||
{ breakoutMeetingId: meetingId },
|
||||
{ breakoutId: meetingId },
|
||||
{ meetingId },
|
||||
{
|
||||
users: {
|
||||
$elemMatch: { userId: requesterUserId },
|
||||
|
@ -88,7 +88,7 @@ export default withRouter(injectIntl(withModalMounter(createContainer((
|
||||
});
|
||||
|
||||
// Close the widow when the current breakout room ends
|
||||
Breakouts.find({ breakoutMeetingId: Auth.meetingID }).observeChanges({
|
||||
Breakouts.find({ breakoutId: Auth.meetingID }).observeChanges({
|
||||
removed() {
|
||||
Auth.clearCredentials().then(window.close);
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Breakouts from '/imports/api/1.1/breakouts';
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
import Settings from '/imports/ui/services/settings';
|
||||
import Auth from '/imports/ui/services/auth/index.js';
|
||||
import Auth from '/imports/ui/services/auth/index';
|
||||
|
||||
const getCaptionsStatus = () => {
|
||||
const ccSettings = Settings.cc;
|
||||
@ -14,7 +14,7 @@ const getFontSize = () => {
|
||||
|
||||
function meetingIsBreakout() {
|
||||
const breakouts = Breakouts.find().fetch();
|
||||
return (breakouts && breakouts.some(b => b.breakoutMeetingId === Auth.meetingID));
|
||||
return (breakouts && breakouts.some(b => b.breakoutId === Auth.meetingID));
|
||||
}
|
||||
|
||||
export {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import Breakouts from '/imports/api/1.1/breakouts';
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
|
||||
const getBreakouts = () => Breakouts.find().fetch();
|
||||
|
||||
@ -7,18 +7,17 @@ const getBreakoutJoinURL = (breakout) => {
|
||||
const currentUserId = Auth.userID;
|
||||
|
||||
if (breakout.users) {
|
||||
const user = breakout.users.find(user => user.userId === currentUserId);
|
||||
const user = breakout.users.find(u => u.userId === currentUserId);
|
||||
|
||||
if (user) {
|
||||
const urlParams = user.urlParams;
|
||||
return [
|
||||
window.origin,
|
||||
'html5client/join',
|
||||
urlParams.meetingId,
|
||||
urlParams.userId,
|
||||
urlParams.authToken,
|
||||
`html5client/join?sessionToken=${urlParams.sessionToken}`,
|
||||
].join('/');
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
export default {
|
||||
|
@ -1,18 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import _ from 'lodash';
|
||||
import NavBarService from '../nav-bar/service';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import { humanizeSeconds } from '/imports/utils/humanizeSeconds';
|
||||
import NavBarService from '../nav-bar/service';
|
||||
|
||||
import NotificationsBar from './component';
|
||||
|
||||
// the connection is up and running
|
||||
const STATUS_CONNECTED = 'connected';
|
||||
|
||||
// disconnected and trying to open a new connection
|
||||
const STATUS_CONNECTING = 'connecting';
|
||||
|
||||
@ -22,9 +18,6 @@ const STATUS_FAILED = 'failed';
|
||||
// failed to connect and waiting to try to reconnect
|
||||
const STATUS_WAITING = 'waiting';
|
||||
|
||||
// user has disconnected the connection
|
||||
const STATUS_OFFLINE = 'offline';
|
||||
|
||||
const intlMessages = defineMessages({
|
||||
failedMessage: {
|
||||
id: 'app.failedMessage',
|
||||
@ -52,25 +45,19 @@ const intlMessages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
class NotificationsBarContainer extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (_.isEmpty(this.props.message)) {
|
||||
const NotificationsBarContainer = (props) => {
|
||||
if (_.isEmpty(props.message)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { message, color } = this.props;
|
||||
const { message, color } = props;
|
||||
|
||||
return (
|
||||
<NotificationsBar color={color}>
|
||||
{message}
|
||||
</NotificationsBar>
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let retrySeconds = 0;
|
||||
let timeRemaining = 0;
|
||||
@ -96,6 +83,15 @@ const setRetrySeconds = (sec = 0) => {
|
||||
}
|
||||
};
|
||||
|
||||
const changeDocumentTitle = (sec) => {
|
||||
if (sec >= 0) {
|
||||
const affix = `(${humanizeSeconds(sec)}`;
|
||||
const splitTitle = document.title.split(') ');
|
||||
const title = splitTitle[1] || splitTitle[0];
|
||||
document.title = [affix, title].join(') ');
|
||||
}
|
||||
};
|
||||
|
||||
const setTimeRemaining = (sec = 0) => {
|
||||
if (sec !== timeRemaining) {
|
||||
timeRemaining = sec;
|
||||
@ -112,31 +108,23 @@ const startCounter = (sec, set, get, interval) => {
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const changeDocumentTitle = (sec) => {
|
||||
if (sec >= 0) {
|
||||
const affix = `(${humanizeSeconds(sec)}`;
|
||||
const splitTitle = document.title.split(') ');
|
||||
const title = splitTitle[1] || splitTitle[0];
|
||||
document.title = [affix, title].join(') ');
|
||||
}
|
||||
};
|
||||
|
||||
export default injectIntl(createContainer(({ intl }) => {
|
||||
const { status, connected, retryCount, retryTime } = Meteor.status();
|
||||
const { status, connected, retryTime } = Meteor.status();
|
||||
const data = {};
|
||||
|
||||
if (!connected) {
|
||||
data.color = 'primary';
|
||||
switch (status) {
|
||||
case STATUS_OFFLINE:
|
||||
case STATUS_FAILED:
|
||||
case STATUS_FAILED: {
|
||||
data.color = 'danger';
|
||||
data.message = intl.formatMessage(intlMessages.failedMessage);
|
||||
break;
|
||||
case STATUS_CONNECTING:
|
||||
}
|
||||
case STATUS_CONNECTING: {
|
||||
data.message = intl.formatMessage(intlMessages.connectingMessage);
|
||||
break;
|
||||
case STATUS_WAITING:
|
||||
}
|
||||
case STATUS_WAITING: {
|
||||
const sec = Math.round((retryTime - (new Date()).getTime()) / 1000);
|
||||
retryInterval = startCounter(sec, setRetrySeconds, getRetrySeconds, retryInterval);
|
||||
data.message = intl.formatMessage(
|
||||
@ -145,6 +133,9 @@ export default injectIntl(createContainer(({ intl }) => {
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -152,10 +143,12 @@ export default injectIntl(createContainer(({ intl }) => {
|
||||
const meetingId = Auth.meetingID;
|
||||
const breakouts = NavBarService.getBreakouts();
|
||||
|
||||
if (breakouts) {
|
||||
const currentBreakout = breakouts.find(b => b.breakoutMeetingId === meetingId);
|
||||
if (breakouts.length > 0) {
|
||||
const currentBreakout = breakouts.find(b => b.breakoutId === meetingId);
|
||||
|
||||
if (currentBreakout) {
|
||||
roomRemainingTime = currentBreakout.timeRemaining;
|
||||
const roomRemainingTime = currentBreakout.timeRemaining;
|
||||
|
||||
if (!timeRemainingInterval && roomRemainingTime) {
|
||||
timeRemainingInterval = startCounter(roomRemainingTime,
|
||||
setTimeRemaining,
|
||||
@ -166,12 +159,13 @@ export default injectIntl(createContainer(({ intl }) => {
|
||||
clearInterval(timeRemainingInterval);
|
||||
}
|
||||
|
||||
const timeRemaining = getTimeRemaining();
|
||||
timeRemaining = getTimeRemaining();
|
||||
|
||||
if (timeRemaining) {
|
||||
if (timeRemaining > 0) {
|
||||
data.message = intl.formatMessage(
|
||||
intlMessages.breakoutTimeRemaining,
|
||||
{ time: humanizeSeconds(timeRemaining) },
|
||||
{ 0: humanizeSeconds(timeRemaining) },
|
||||
);
|
||||
} else {
|
||||
clearInterval(timeRemainingInterval);
|
||||
|
Loading…
Reference in New Issue
Block a user