bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/modal/random-user/container.jsx

67 lines
1.9 KiB
React
Raw Normal View History

import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import { withModalMounter } from '/imports/ui/components/modal/service';
import { makeCall } from '/imports/ui/services/api';
import RandomUserSelect from './component';
2021-03-20 02:52:03 +08:00
const SELECT_RANDOM_USER_ENABLED = Meteor.settings.public.selectRandomUser.enabled;
const RandomUserSelectContainer = props => <RandomUserSelect {...props} />;
export default withModalMounter(withTracker(({ mountModal }) => {
const viewerPool = Users.find({
meetingId: Auth.meetingID,
presenter: { $ne: true },
role: { $eq: 'VIEWER' },
}, {
fields: {
userId: 1,
},
}).fetch();
const meeting = Meetings.findOne({ meetingId: Auth.meetingID }, {
fields: {
randomlySelectedUser: 1,
},
});
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
let mappedRandomlySelectedUsers = [];
if (meeting.randomlySelectedUser) {
mappedRandomlySelectedUsers = meeting.randomlySelectedUser.map(function(ui) {
const selectedUser = Users.findOne({
meetingId: Auth.meetingID,
userId: ui[0],
}, {
fields: {
userId: 1,
avatar: 1,
color: 1,
name: 1,
},
});
return [selectedUser,ui[1]];
});
}
const currentUser = Users.findOne(
{ userId: Auth.userID },
{ fields: { userId: 1, presenter: 1 } },
);
2021-03-20 02:52:03 +08:00
const randomUserReq = () => (SELECT_RANDOM_USER_ENABLED ? makeCall('setRandomUser') : null);
2021-03-20 02:52:03 +08:00
const clearRandomlySelectedUser = () => (SELECT_RANDOM_USER_ENABLED ? makeCall('clearRandomlySelectedUser') : null);
return ({
closeModal: () => mountModal(null),
numAvailableViewers: viewerPool.length,
randomUserReq,
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
mappedRandomlySelectedUsers,
currentUser,
clearRandomlySelectedUser,
});
})(RandomUserSelectContainer));