2021-04-07 03:58:11 +08:00
|
|
|
import React, { useContext } from 'react';
|
2019-02-27 01:08:15 +08:00
|
|
|
import { Session } from 'meteor/session';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import GuestUsers from '/imports/api/guest-users/';
|
2021-04-07 03:58:11 +08:00
|
|
|
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
2019-02-27 01:08:15 +08:00
|
|
|
import WaitingComponent from './component';
|
|
|
|
|
|
|
|
const USER_CONFIG = Meteor.settings.public.user;
|
|
|
|
const ROLE_MODERATOR = USER_CONFIG.role_moderator;
|
|
|
|
|
2021-04-07 03:58:11 +08:00
|
|
|
const WaitingContainer = (props) => {
|
|
|
|
const usingUsersContext = useContext(UsersContext);
|
|
|
|
const { users } = usingUsersContext;
|
2021-04-15 20:12:21 +08:00
|
|
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
2021-04-07 03:58:11 +08:00
|
|
|
const currentUserIsModerator = currentUser.role === ROLE_MODERATOR;
|
|
|
|
const joinTime = currentUser.authTokenValidatedTime;
|
|
|
|
return (
|
|
|
|
<WaitingComponent {...{
|
|
|
|
...props,
|
|
|
|
currentUserIsModerator,
|
|
|
|
joinTime,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-02-27 01:08:15 +08:00
|
|
|
|
|
|
|
export default withTracker(() => {
|
2019-02-27 01:21:57 +08:00
|
|
|
const pendingUsers = GuestUsers.find({
|
2019-02-27 01:08:15 +08:00
|
|
|
meetingId: Auth.meetingID,
|
|
|
|
approved: false,
|
|
|
|
denied: false,
|
|
|
|
}).fetch();
|
|
|
|
const managementPanelIsOpen = Session.get('openPanel') === 'waitingUsersPanel';
|
|
|
|
|
|
|
|
return {
|
|
|
|
managementPanelIsOpen,
|
2019-02-27 01:21:57 +08:00
|
|
|
pendingUsers,
|
2019-02-27 01:08:15 +08:00
|
|
|
};
|
|
|
|
})(WaitingContainer);
|