Changes breakout code to handle the new message format
This commit is contained in:
parent
e14c9159df
commit
0aa6022c89
@ -22,12 +22,12 @@ export default function breakoutJoinURL({ payload }) {
|
||||
const CLIENT_HTML = 'HTML5';
|
||||
|
||||
const {
|
||||
joinURL,
|
||||
noRedirectJoinURL,
|
||||
} = payload;
|
||||
|
||||
check(joinURL, String);
|
||||
check(noRedirectJoinURL, String);
|
||||
|
||||
const urlParams = getUrlParams(joinURL);
|
||||
const urlParams = getUrlParams(noRedirectJoinURL);
|
||||
|
||||
const selector = {
|
||||
externalMeetingId: urlParams.meetingID,
|
||||
@ -35,67 +35,49 @@ export default function breakoutJoinURL({ payload }) {
|
||||
|
||||
let breakout = Breakouts.findOne(selector);
|
||||
|
||||
if (urlParams.redirect !== 'false') {
|
||||
const MessageContent = {
|
||||
breakoutMeetingId: breakout.externalMeetingId,
|
||||
meetingId: breakout.parentMeetingId,
|
||||
redirect: false,
|
||||
const res = Meteor.http.call('get', noRedirectJoinURL);
|
||||
xmlParser.parseString(res.content, (err, parsedXML) => {
|
||||
breakout = Breakouts.findOne(selector);
|
||||
|
||||
const { response } = parsedXML;
|
||||
let users = breakout.users;
|
||||
|
||||
let user = {
|
||||
userId: payload.userId,
|
||||
urlParams: {
|
||||
meetingId: response.meeting_id[0],
|
||||
userId: response.user_id[0],
|
||||
authToken: response.auth_token[0],
|
||||
},
|
||||
};
|
||||
|
||||
const CHANNEL = REDIS_CONFIG.channels.toBBBApps.users;
|
||||
const eventName = 'RequestBreakoutJoinURL';
|
||||
const userExists = users.find(u => user.userId === u.userId);
|
||||
|
||||
const clientType = Users.findOne({ userId: payload.userId }).clientType;
|
||||
|
||||
if (clientType === CLIENT_HTML) {
|
||||
return RedisPubSub.publish(CHANNEL, eventName, MessageContent);
|
||||
if (userExists) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const res = Meteor.http.call('get', joinURL);
|
||||
xmlParser.parseString(res.content, (err, parsedXML) => {
|
||||
breakout = Breakouts.findOne(selector);
|
||||
|
||||
const { response } = parsedXML;
|
||||
let users = breakout.users;
|
||||
const modifier = {
|
||||
$push: {
|
||||
users: user,
|
||||
},
|
||||
};
|
||||
|
||||
let user = {
|
||||
userId: payload.userId,
|
||||
urlParams: {
|
||||
meetingId: response.meeting_id[0],
|
||||
userId: response.user_id[0],
|
||||
authToken: response.auth_token[0],
|
||||
},
|
||||
};
|
||||
|
||||
const userExists = users.find(u => user.userId === u.userId);
|
||||
|
||||
if (userExists) {
|
||||
return;
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding breakout to collection: ${err}`);
|
||||
}
|
||||
|
||||
const modifier = {
|
||||
$push: {
|
||||
users: user,
|
||||
},
|
||||
};
|
||||
const {
|
||||
insertedId,
|
||||
} = numChanged;
|
||||
if (insertedId) {
|
||||
return Logger.info(`Added breakout id=${urlParams.meetingID}`);
|
||||
}
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding breakout to collection: ${err}`);
|
||||
}
|
||||
return Logger.info(`Upserted breakout id=${urlParams.meetingID}`);
|
||||
};
|
||||
|
||||
const {
|
||||
insertedId,
|
||||
} = numChanged;
|
||||
if (insertedId) {
|
||||
return Logger.info(`Added breakout id=${urlParams.meetingID}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted breakout id=${urlParams.meetingID}`);
|
||||
};
|
||||
|
||||
return Breakouts.upsert(selector, modifier, cb);
|
||||
});
|
||||
}
|
||||
return Breakouts.upsert(selector, modifier, cb);
|
||||
});
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export default function removeMeeting(meetingId) {
|
||||
if (numChanged) {
|
||||
clearCaptionsCollection(meetingId);
|
||||
clearChats(meetingId);
|
||||
clearCursorCollection(meetingId);
|
||||
clearCursor(meetingId);
|
||||
clearPresentations(meetingId);
|
||||
clearPolls(meetingId);
|
||||
clearShapesCollection(meetingId);
|
||||
|
@ -46,6 +46,11 @@ class NavBar extends Component {
|
||||
this.handleToggleUserList = this.handleToggleUserList.bind(this);
|
||||
}
|
||||
|
||||
componendDidMount() {
|
||||
const presentationTitle = this.props.presentationTitle;
|
||||
document.title = presentationTitle;
|
||||
}
|
||||
|
||||
handleToggleUserList() {
|
||||
this.props.toggleUserList();
|
||||
}
|
||||
@ -93,7 +98,6 @@ class NavBar extends Component {
|
||||
let breakouts = this.props.breakouts;
|
||||
const meetingId = Auth.getCredentials().meetingId;
|
||||
const currentUserId = Auth.getCredentials().requesterUserId;
|
||||
document.title = presentationTitle;
|
||||
|
||||
breakouts = breakouts.filter(breakout => {
|
||||
if (!breakout.users) {
|
||||
|
@ -6,6 +6,8 @@ import _ from 'underscore';
|
||||
import NavBarService from '../nav-bar/service';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
|
||||
import Breakouts from '/imports/api/breakouts';
|
||||
|
||||
import NotificationsBar from './component';
|
||||
|
||||
const humanizeSeconds = time => {
|
||||
@ -85,15 +87,23 @@ class NotificationsBarContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
//reconnect
|
||||
let retrySeconds = 0;
|
||||
let timeRemaining = 0;
|
||||
const retrySecondsDep = new Tracker.Dependency;
|
||||
const timeRemainingDep = new Tracker.Dependency;
|
||||
let retryInterval = null;
|
||||
let timeRemainingInterval = null;
|
||||
|
||||
const getRetrySeconds = () => {
|
||||
retrySecondsDep.depend();
|
||||
return retrySeconds;
|
||||
};
|
||||
|
||||
const getTimeRemaining = () => {
|
||||
timeRemainingDep.depend();
|
||||
return timeRemaining;
|
||||
};
|
||||
|
||||
const setRetrySeconds = (sec = 0) => {
|
||||
if (sec !== retrySeconds) {
|
||||
retrySeconds = sec;
|
||||
@ -101,53 +111,37 @@ const setRetrySeconds = (sec = 0) => {
|
||||
}
|
||||
};
|
||||
|
||||
let retryInterval = null;
|
||||
let timeRemainingInterval = null;
|
||||
|
||||
const startCounterRetry = (sec) => {
|
||||
clearInterval(retryInterval);
|
||||
setRetrySeconds(sec);
|
||||
retryInterval = setInterval(() => {
|
||||
setRetrySeconds(getRetrySeconds() - 1);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const startCounterTimeRemaining = (sec) => {
|
||||
clearInterval(timeRemainingInterval);
|
||||
setTimeRemaining(sec);
|
||||
timeRemainingInterval = setInterval(() => {
|
||||
setTimeRemaining(getTimeRemaining() - 1);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
// breakout
|
||||
let timeRemaining = 0;
|
||||
const timeRemainingDep = new Tracker.Dependency;
|
||||
|
||||
const getTimeRemaining = () => {
|
||||
timeRemainingDep.depend();
|
||||
return timeRemaining;
|
||||
};
|
||||
|
||||
const setTimeRemaining = (sec = 0) => {
|
||||
if (sec !== timeRemaining) {
|
||||
timeRemaining = sec;
|
||||
|
||||
if (sec >= 0) {
|
||||
const affix = `(${humanizeSeconds(sec)}`;
|
||||
const splitTitle = document.title.split(') ');
|
||||
const title = splitTitle[1] || splitTitle[0];
|
||||
document.title = [affix, title].join(') ');
|
||||
}
|
||||
|
||||
changeDocumentTitle(sec);
|
||||
timeRemainingDep.changed();
|
||||
}
|
||||
};
|
||||
|
||||
const startCounter = (sec, set, get, interval) => {
|
||||
clearInterval(interval);
|
||||
set(sec);
|
||||
return setInterval(() => {
|
||||
set(get() - 1);
|
||||
}, 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();
|
||||
let data = {};
|
||||
|
||||
window.Breakouts = Breakouts;
|
||||
|
||||
if (!connected) {
|
||||
data.color = 'primary';
|
||||
switch (status) {
|
||||
@ -161,13 +155,15 @@ export default injectIntl(createContainer(({ intl }) => {
|
||||
break;
|
||||
case STATUS_WAITING:
|
||||
const sec = Math.round((retryTime - (new Date()).getTime()) / 1000);
|
||||
startCounterRetry(sec);
|
||||
retryInterval = startCounter(sec, setRetrySeconds, getRetrySeconds, retryInterval);
|
||||
data.message = intl.formatMessage(
|
||||
intlMessages.waitingMessage,
|
||||
{ seconds: getRetrySeconds() }
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const meetingId = Auth.meetingID;
|
||||
@ -179,7 +175,10 @@ export default injectIntl(createContainer(({ intl }) => {
|
||||
if (currentBreakout) {
|
||||
roomRemainingTime = currentBreakout.timeRemaining;
|
||||
if (!timeRemainingInterval && roomRemainingTime) {
|
||||
startCounterTimeRemaining(roomRemainingTime);
|
||||
timeRemainingInterval = startCounter(roomRemainingTime,
|
||||
setTimeRemaining,
|
||||
getTimeRemaining,
|
||||
timeRemainingInterval);
|
||||
}
|
||||
} else if (timeRemainingInterval) {
|
||||
clearInterval(timeRemainingInterval);
|
||||
|
@ -12,10 +12,15 @@ let getSlideData = (params) => {
|
||||
const meetingId = AuthSingleton.getCredentials().meetingId;
|
||||
|
||||
// Find the user object of this specific meeting and userid
|
||||
const userIsPresenter = Users.findOne({
|
||||
const currentUser = Users.findOne({
|
||||
meetingId: meetingId,
|
||||
userId: userId,
|
||||
}).user.presenter;
|
||||
});
|
||||
|
||||
let userIsPresenter;
|
||||
if (currentUser && currentUser.user) {
|
||||
userIsPresenter = currentUser.user.presenter;
|
||||
}
|
||||
|
||||
// Get total number of slides in this presentation
|
||||
const numberOfSlides = Slides.find({
|
||||
|
Loading…
Reference in New Issue
Block a user