2021-10-20 04:35:39 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
2020-10-03 01:29:27 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2019-02-27 01:08:15 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
|
|
|
|
|
|
|
const guestUsersCall = (guestsArray, status) => makeCall('allowPendingUsers', guestsArray, status);
|
|
|
|
|
2021-09-04 19:45:52 +08:00
|
|
|
const changeGuestPolicy = (policyRule) => makeCall('changeGuestPolicy', policyRule);
|
2020-10-03 01:29:27 +08:00
|
|
|
|
2020-02-04 04:41:12 +08:00
|
|
|
const getGuestPolicy = () => {
|
|
|
|
const meeting = Meetings.findOne(
|
|
|
|
{ meetingId: Auth.meetingID },
|
|
|
|
{ fields: { 'usersProp.guestPolicy': 1 } },
|
|
|
|
);
|
|
|
|
|
|
|
|
return meeting.usersProp.guestPolicy;
|
|
|
|
};
|
|
|
|
|
2021-09-04 19:45:52 +08:00
|
|
|
const isWaitingRoomEnabled = () => getGuestPolicy() === 'ASK_MODERATOR';
|
|
|
|
|
2020-10-03 01:29:27 +08:00
|
|
|
const isGuestLobbyMessageEnabled = Meteor.settings.public.app.enableGuestLobbyMessage;
|
|
|
|
|
2021-05-13 00:01:04 +08:00
|
|
|
// We use the dynamicGuestPolicy rule for allowing the rememberChoice checkbox
|
|
|
|
const allowRememberChoice = Meteor.settings.public.app.dynamicGuestPolicy;
|
|
|
|
|
2020-10-03 01:29:27 +08:00
|
|
|
const getGuestLobbyMessage = () => {
|
|
|
|
const meeting = Meetings.findOne(
|
|
|
|
{ meetingId: Auth.meetingID },
|
|
|
|
{ fields: { guestLobbyMessage: 1 } },
|
|
|
|
);
|
|
|
|
|
|
|
|
if (meeting) return meeting.guestLobbyMessage;
|
|
|
|
|
|
|
|
return '';
|
|
|
|
};
|
|
|
|
|
|
|
|
const setGuestLobbyMessage = (message) => makeCall('setGuestLobbyMessage', message);
|
|
|
|
|
2019-02-27 01:08:15 +08:00
|
|
|
export default {
|
|
|
|
guestUsersCall,
|
2019-04-04 04:11:47 +08:00
|
|
|
changeGuestPolicy,
|
2020-02-04 04:41:12 +08:00
|
|
|
getGuestPolicy,
|
2021-09-04 19:45:52 +08:00
|
|
|
isWaitingRoomEnabled,
|
2020-10-03 01:29:27 +08:00
|
|
|
isGuestLobbyMessageEnabled,
|
|
|
|
getGuestLobbyMessage,
|
|
|
|
setGuestLobbyMessage,
|
2021-05-13 00:01:04 +08:00
|
|
|
allowRememberChoice,
|
2019-02-27 01:08:15 +08:00
|
|
|
};
|