Merge pull request #4181 from JaeeunCho/destroy_meeting_users

[HTML5 2.0] End meeting by moderator
This commit is contained in:
Anton Georgiev 2017-09-05 09:54:19 -04:00 committed by GitHub
commit a68222dfff
9 changed files with 117 additions and 5 deletions

View File

@ -1,4 +1,7 @@
import { Meteor } from 'meteor/meteor';
import mapToAcl from '/imports/startup/mapToAcl';
import endMeeting from './methods/endMeeting';
Meteor.methods({
});
Meteor.methods(mapToAcl(['methods.endMeeting'], {
endMeeting,
}));

View File

@ -0,0 +1,30 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import RedisPubSub from '/imports/startup/server/redis2x';
import Logger from '/imports/startup/server/logger';
export default function endMeeting(credentials) {
const REDIS_CONFIG = Meteor.settings.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'LogoutAndEndMeetingCmdMsg';
const { meetingId, requesterUserId, requesterToken } = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
const payload = {
userId: requesterUserId,
};
const header = {
meetingId,
name: EVENT_NAME,
userId: requesterUserId,
};
Logger.verbose(`Meeting '${meetingId}' is destroyed by '${requesterUserId}'`);
return RedisPubSub.publish(CHANNEL, EVENT_NAME, meetingId, payload, header);
}

View File

@ -1,7 +1,9 @@
import React, { Component } from 'react';
import { withRouter } from 'react-router';
import { defineMessages, injectIntl } from 'react-intl';
import Button from '/imports/ui/components/button/component';
import Modal from '/imports/ui/components/modal/fullscreen/component';
import styles from './styles.scss';
const intlMessages = defineMessages({
title: {
@ -28,11 +30,20 @@ const intlMessages = defineMessages({
id: 'app.leaveConfirmation.dismissDesc',
description: 'adds context to dismiss option',
},
endMeetingLabel: {
id: 'app.leaveConfirmation.endMeetingLabel',
description: 'End meeting button label',
},
endMeetingDesc: {
id: 'app.leaveConfirmation.endMeetingDesc',
description: 'adds context to end meeting option',
},
});
class LeaveConfirmation extends Component {
render() {
const { intl, router } = this.props;
const { intl, router, endMeeting, isModerator } = this.props;
return (
<Modal
@ -49,6 +60,15 @@ class LeaveConfirmation extends Component {
}}
>
{intl.formatMessage(intlMessages.message)}
{isModerator ?
<Button
className={styles.endMeeting}
label={intl.formatMessage(intlMessages.endMeetingLabel)}
onClick={endMeeting}
aria-describedby={'modalEndMeetingDesc'}
/> : null
}
<div id="modalEndMeetingDesc" hidden>{intl.formatMessage(intlMessages.endMeetingDesc)}</div>
</Modal>
);
}

View File

@ -0,0 +1,26 @@
import React, { Component } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import LogoutConfirmation from './component';
import LogoutConfirmationService from './service';
class LogoutConfirmationContainer extends Component {
constructor(props) {
super(props);
}
render() {
return(
<LogoutConfirmation {...this.props} />
);
}
}
export default createContainer(() => {
return {
isModerator: LogoutConfirmationService.isModerator(),
endMeeting: LogoutConfirmationService.endMeeting,
};
}, LogoutConfirmationContainer);

View File

@ -0,0 +1,20 @@
import { makeCall } from '/imports/ui/services/api/index.js';
import Users from '/imports/api/2.0/users';
import mapUser from '/imports/ui/services/user/mapUser';
import Auth from '/imports/ui/services/auth';
const endMeeting = () => {
makeCall('endMeeting', Auth.credentials);
};
const isModerator = () => {
const currentUserId = Auth.userID;
const currentUser = Users.findOne({ userId: currentUserId });
return (currentUser) ? mapUser(currentUser).isModerator : null;
};
export default {
endMeeting,
isModerator,
};

View File

@ -0,0 +1,8 @@
%btn {
flex: 0 1 48%;
}
.endMeeting {
@extend %btn;
margin-left: 5rem;
}

View File

@ -6,7 +6,7 @@ import styles from '../styles';
import { withModalMounter } from '/imports/ui/components/modal/service';
import LogoutConfirmation from '/imports/ui/components/logout-confirmation/component';
import LogoutConfirmationContainer from '/imports/ui/components/logout-confirmation/container';
import AboutContainer from '/imports/ui/components/about/container';
import SettingsMenuContainer from '/imports/ui/components/settings/container';
@ -146,7 +146,7 @@ class SettingsDropdown extends Component {
icon="logout"
label={intl.formatMessage(intlMessages.leaveSessionLabel)}
description={intl.formatMessage(intlMessages.leaveSessionDesc)}
onClick={() => mountModal(<LogoutConfirmation />)}
onClick={() => mountModal(<LogoutConfirmationContainer />)}
/>
</DropdownList>
</DropdownContent>

3
bigbluebutton-html5/private/config/public/acl.yaml Normal file → Executable file
View File

@ -24,6 +24,9 @@ acl:
methods:
- 'assignPresenter'
- 'kickUser'
- 'muteUser'
- 'unmuteUser'
- 'endMeeting'
- 'toggleVoice'
- 'clearPublicChatHistory'
presenter:

View File

@ -70,6 +70,8 @@
"app.leaveConfirmation.confirmDesc": "Logs you out of the meeting",
"app.leaveConfirmation.dismissLabel": "Cancel",
"app.leaveConfirmation.dismissDesc": "Closes and rejects the leave confirmation",
"app.leaveConfirmation.endMeetingLabel": "Yes and close the session",
"app.leaveConfirmation.endMeetingDesc": "Closes and end meeting confirmation",
"app.about.title": "About",
"app.about.version": "Client Build:",
"app.about.copyright": "Copyright:",