bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/app/container.jsx

132 lines
4.0 KiB
React
Raw Normal View History

import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { defineMessages, injectIntl } from 'react-intl';
2017-10-06 22:58:21 +08:00
import PropTypes from 'prop-types';
2017-07-14 22:18:07 +08:00
import Auth from '/imports/ui/services/auth';
import AuthTokenValidation from '/imports/api/auth-token-validation';
import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings';
import { notify } from '/imports/ui/services/notification';
import CaptionsContainer from '/imports/ui/components/captions/container';
import CaptionsService from '/imports/ui/components/captions/service';
import getFromUserSettings from '/imports/ui/services/users-settings';
import deviceInfo from '/imports/utils/deviceInfo';
2019-04-11 03:40:40 +08:00
import UserInfos from '/imports/api/users-infos';
import { startBandwidthMonitoring, updateNavigatorConnection } from '/imports/ui/services/network-information/index';
2019-04-11 03:40:40 +08:00
import {
getFontSize,
2018-10-24 01:18:09 +08:00
getBreakoutRooms,
validIOSVersion,
} from './service';
2017-04-19 03:06:51 +08:00
import { withModalMounter } from '../modal/service';
import App from './component';
import NavBarContainer from '../nav-bar/container';
import ActionsBarContainer from '../actions-bar/container';
import MediaContainer from '../media/container';
2017-10-06 22:58:21 +08:00
const propTypes = {
navbar: PropTypes.node,
actionsbar: PropTypes.node,
media: PropTypes.node,
};
2016-04-29 03:02:51 +08:00
const defaultProps = {
2016-07-21 22:24:50 +08:00
navbar: <NavBarContainer />,
2016-07-23 02:47:54 +08:00
actionsbar: <ActionsBarContainer />,
2016-07-21 22:24:50 +08:00
media: <MediaContainer />,
2016-04-29 03:02:51 +08:00
};
const intlMessages = defineMessages({
2017-07-14 22:18:07 +08:00
waitingApprovalMessage: {
id: 'app.guest.waiting',
description: 'Message while a guest is waiting to be approved',
},
});
2018-10-25 23:20:37 +08:00
const endMeeting = (code) => {
Session.set('codeError', code);
Session.set('isMeetingEnded', true);
};
2017-07-14 22:18:07 +08:00
const AppContainer = (props) => {
2017-10-06 22:58:21 +08:00
const {
navbar,
actionsbar,
media,
...otherProps
} = props;
2017-07-14 22:18:07 +08:00
return (
2017-10-06 22:58:21 +08:00
<App
navbar={navbar}
2017-10-06 22:58:21 +08:00
actionsbar={actionsbar}
media={media}
{...otherProps}
/>
2017-07-14 22:18:07 +08:00
);
};
const currentUserEmoji = currentUser => (currentUser ? {
status: currentUser.emoji,
changedAt: currentUser.emojiTime,
} : {
status: 'none',
changedAt: null,
});
2018-10-03 03:53:13 +08:00
export default injectIntl(withModalMounter(withTracker(({ intl, baseControls }) => {
const authTokenValidation = AuthTokenValidation.findOne({}, { sort: { updatedAt: -1 } });
if (authTokenValidation.connectionId !== Meteor.connection._lastSessionId) {
endMeeting('403');
}
Users.find({ userId: Auth.userID, meetingId: Auth.meetingID }).observe({
removed() {
endMeeting('403');
},
});
Fancy random viewer selection (#11297) * Revert "Delete bbb-icons-ori.woff" This reverts commit 84937a0d076f79076d8df201e3edb278374df0d0. * Revert "Add files via upload" This reverts commit 391434445ab286a160fde63533fa843175e9e8a0. * Revert "Delete bbb-icons.woff" This reverts commit 7c245c666d9adc7a8a1b1dc88b01bce749109b2f. * Revert "Add files via upload" This reverts commit 6f8c764c4bc35d646d9691cec8298d0ad3b98b11. * Revert "Delete tmp.woff" This reverts commit 5141e653599b4d83ddff6123ed59c1e4eb4d18e0. * Revert "Add files via upload" This reverts commit c8f7b17b0483910b6fa2750b2138cc3895e57145. * Revert "Create tmp.woff" This reverts commit 73c45065944d96f7779971b3535943c96feb2897. * Revert "Delete bbb-icons.woff" This reverts commit 9d01d58527bac04ebbf9be61140a13e7e14d7cc8. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit d221d290cd5ad33b3c455b09f9da36d5788ee152. * Revert "Revert "Revert "Delete bbb-icons.woff""" This reverts commit c415ff02d1bd710e6f8804667c69d3c7d2e4caf1. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit d221d290cd5ad33b3c455b09f9da36d5788ee152. * Revert "Revert "Create tmp.woff"" This reverts commit 267dc412d561c3d2eac49959e4b0ada77b8364bd. * Revert "Delete bbb-icons-ori.woff" This reverts commit 84937a0d076f79076d8df201e3edb278374df0d0. * Revert "Delete bbb-icons.woff" This reverts commit 7c245c666d9adc7a8a1b1dc88b01bce749109b2f. * Revert "Add files via upload" This reverts commit 6f8c764c4bc35d646d9691cec8298d0ad3b98b11. * Revert "Add files via upload" This reverts commit c8f7b17b0483910b6fa2750b2138cc3895e57145. * Revert "Create tmp.woff" This reverts commit 73c45065944d96f7779971b3535943c96feb2897. * Revert "Delete bbb-icons.woff" This reverts commit 9d01d58527bac04ebbf9be61140a13e7e14d7cc8. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit 64a48f2bd6d76ca7fe31bc606682700ec1078592. * Revert "Revert "Revert "Delete bbb-icons.woff""" This reverts commit 9d1b4a068ae4de2ca3ad2e842884c910e16af0b9. * Revert "Revert "Revert "Revert "Delete bbb-icons.woff"""" This reverts commit b60491d933c2c984a5a64fa162026430d5f51485. * Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff""""" This reverts commit 16e357091d558afe07bf17c7fedaa13ac8905f27. * Revert "Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff"""""" This reverts commit e0b70f20554884f7c9e64104a3f942d3d09bfe24. * Revert "Revert "Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff""""""" This reverts commit 7b1bde97edbed7985beb63646d39c3ddc82138e6. * Update UsersMgs.scala * Update selectRandomViewer.js * Update clearRandomlySelectedUser.js * Update addMeeting.js * Update updateRandomViewer.js * Update component.jsx * Update container.jsx * Update component.jsx * Update container.jsx * Update styles.scss * Update en.json * Update SelectRandomViewerReqMsgHdlr.scala * code simplification * in case only one person to be selected * Update en.json * Create en.json * Update en.json * Update component.jsx * Update styles.scss * Update en.json * Update updateRandomViewer.js Fix a typo * Update component.jsx When the presenter is moved to a viewer, in the modal of ex-presenter "somebody is selected" should be displayed. Before this modification, "somebody is the only viewer" was displayed. * add a comment explaining why a condition is needed. * Update en.json * Update en.json * revert (due to the rename UserMgs -> UserMsgs) * Update UsersMsgs.scala
2021-04-15 23:12:10 +08:00
const currentUser = Users.findOne({ userId: Auth.userID }, { fields: { approved: 1, emoji: 1, userId: 1, presenter: 1 } });
const currentMeeting = Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { publishedPoll: 1, voiceProp: 1, randomlySelectedUser: 1 } });
const { publishedPoll, voiceProp, randomlySelectedUser } = currentMeeting;
2017-07-14 22:18:07 +08:00
2018-07-19 20:46:44 +08:00
if (!currentUser.approved) {
baseControls.updateLoadingState(intl.formatMessage(intlMessages.waitingApprovalMessage));
}
2017-07-18 00:38:18 +08:00
2019-04-12 04:54:15 +08:00
const UserInfo = UserInfos.find({
meetingId: Auth.meetingID,
requesterUserId: Auth.userID,
}).fetch();
2017-06-03 03:25:02 +08:00
return {
captions: CaptionsService.isCaptionsActive() ? <CaptionsContainer /> : null,
2017-06-03 03:25:02 +08:00
fontSize: getFontSize(),
2018-10-24 01:18:09 +08:00
hasBreakoutRooms: getBreakoutRooms().length > 0,
customStyle: getFromUserSettings('bbb_custom_style', false),
customStyleUrl: getFromUserSettings('bbb_custom_style_url', false),
openPanel: Session.get('openPanel'),
2019-04-11 03:40:40 +08:00
UserInfo,
notify,
validIOSVersion,
2021-04-01 01:13:36 +08:00
isPhone: deviceInfo.isPhone,
2019-07-16 03:15:58 +08:00
isRTL: document.documentElement.getAttribute('dir') === 'rtl',
2019-06-01 02:36:52 +08:00
meetingMuted: voiceProp.muteOnStart,
currentUserEmoji: currentUserEmoji(currentUser),
2019-06-01 02:36:52 +08:00
hasPublishedPoll: publishedPoll,
startBandwidthMonitoring,
handleNetworkConnection: () => updateNavigatorConnection(navigator.connection),
randomlySelectedUser,
currentUserId: currentUser.userId,
Fancy random viewer selection (#11297) * Revert "Delete bbb-icons-ori.woff" This reverts commit 84937a0d076f79076d8df201e3edb278374df0d0. * Revert "Add files via upload" This reverts commit 391434445ab286a160fde63533fa843175e9e8a0. * Revert "Delete bbb-icons.woff" This reverts commit 7c245c666d9adc7a8a1b1dc88b01bce749109b2f. * Revert "Add files via upload" This reverts commit 6f8c764c4bc35d646d9691cec8298d0ad3b98b11. * Revert "Delete tmp.woff" This reverts commit 5141e653599b4d83ddff6123ed59c1e4eb4d18e0. * Revert "Add files via upload" This reverts commit c8f7b17b0483910b6fa2750b2138cc3895e57145. * Revert "Create tmp.woff" This reverts commit 73c45065944d96f7779971b3535943c96feb2897. * Revert "Delete bbb-icons.woff" This reverts commit 9d01d58527bac04ebbf9be61140a13e7e14d7cc8. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit d221d290cd5ad33b3c455b09f9da36d5788ee152. * Revert "Revert "Revert "Delete bbb-icons.woff""" This reverts commit c415ff02d1bd710e6f8804667c69d3c7d2e4caf1. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit d221d290cd5ad33b3c455b09f9da36d5788ee152. * Revert "Revert "Create tmp.woff"" This reverts commit 267dc412d561c3d2eac49959e4b0ada77b8364bd. * Revert "Delete bbb-icons-ori.woff" This reverts commit 84937a0d076f79076d8df201e3edb278374df0d0. * Revert "Delete bbb-icons.woff" This reverts commit 7c245c666d9adc7a8a1b1dc88b01bce749109b2f. * Revert "Add files via upload" This reverts commit 6f8c764c4bc35d646d9691cec8298d0ad3b98b11. * Revert "Add files via upload" This reverts commit c8f7b17b0483910b6fa2750b2138cc3895e57145. * Revert "Create tmp.woff" This reverts commit 73c45065944d96f7779971b3535943c96feb2897. * Revert "Delete bbb-icons.woff" This reverts commit 9d01d58527bac04ebbf9be61140a13e7e14d7cc8. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit 64a48f2bd6d76ca7fe31bc606682700ec1078592. * Revert "Revert "Revert "Delete bbb-icons.woff""" This reverts commit 9d1b4a068ae4de2ca3ad2e842884c910e16af0b9. * Revert "Revert "Revert "Revert "Delete bbb-icons.woff"""" This reverts commit b60491d933c2c984a5a64fa162026430d5f51485. * Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff""""" This reverts commit 16e357091d558afe07bf17c7fedaa13ac8905f27. * Revert "Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff"""""" This reverts commit e0b70f20554884f7c9e64104a3f942d3d09bfe24. * Revert "Revert "Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff""""""" This reverts commit 7b1bde97edbed7985beb63646d39c3ddc82138e6. * Update UsersMgs.scala * Update selectRandomViewer.js * Update clearRandomlySelectedUser.js * Update addMeeting.js * Update updateRandomViewer.js * Update component.jsx * Update container.jsx * Update component.jsx * Update container.jsx * Update styles.scss * Update en.json * Update SelectRandomViewerReqMsgHdlr.scala * code simplification * in case only one person to be selected * Update en.json * Create en.json * Update en.json * Update component.jsx * Update styles.scss * Update en.json * Update updateRandomViewer.js Fix a typo * Update component.jsx When the presenter is moved to a viewer, in the modal of ex-presenter "somebody is selected" should be displayed. Before this modification, "somebody is the only viewer" was displayed. * add a comment explaining why a condition is needed. * Update en.json * Update en.json * revert (due to the rename UserMgs -> UserMsgs) * Update UsersMsgs.scala
2021-04-15 23:12:10 +08:00
isPresenter: currentUser.presenter,
2017-06-03 03:25:02 +08:00
};
2018-10-03 03:53:13 +08:00
})(AppContainer)));
AppContainer.defaultProps = defaultProps;
2017-10-06 22:58:21 +08:00
AppContainer.propTypes = propTypes;