bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/waiting-users/alert/container.jsx

47 lines
1.5 KiB
React
Raw Normal View History

import React, { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import Auth from '/imports/ui/services/auth';
import GuestUsers from '/imports/api/guest-users/';
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
import WaitingComponent from './component';
2021-09-11 04:48:52 +08:00
import { layoutSelectInput, layoutDispatch } from '../../layout/context';
2021-05-18 04:25:07 +08:00
import { PANELS } from '../../layout/enums';
const USER_CONFIG = Meteor.settings.public.user;
const ROLE_MODERATOR = USER_CONFIG.role_moderator;
const WaitingContainer = (props) => {
2021-09-11 04:48:52 +08:00
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
const { sidebarContentPanel } = sidebarContent;
2021-05-18 04:25:07 +08:00
const managementPanelIsOpen = sidebarContentPanel === PANELS.WAITING_USERS;
2021-09-11 04:48:52 +08:00
const layoutContextDispatch = layoutDispatch();
2021-05-18 04:25:07 +08:00
const usingUsersContext = useContext(UsersContext);
const { users } = usingUsersContext;
2021-04-15 20:12:21 +08:00
const currentUser = users[Auth.meetingID][Auth.userID];
const currentUserIsModerator = currentUser.role === ROLE_MODERATOR;
const joinTime = currentUser.authTokenValidatedTime;
return (
<WaitingComponent {...{
2021-08-05 19:03:24 +08:00
layoutContextDispatch,
2021-05-18 04:25:07 +08:00
managementPanelIsOpen,
...props,
currentUserIsModerator,
joinTime,
}}
/>
);
};
export default withTracker(() => {
const pendingUsers = GuestUsers.find({
meetingId: Auth.meetingID,
approved: false,
denied: false,
}).fetch();
return {
pendingUsers,
};
})(WaitingContainer);