Merge pull request #3731 from antobinary/br-kick

[HTML5] Do not allow breakout room users to kick each other
This commit is contained in:
Anton Georgiev 2017-03-15 15:12:00 -04:00 committed by GitHub
commit aeebfa27d0
6 changed files with 22 additions and 12 deletions

View File

@ -91,6 +91,11 @@ function observeBreakoutEnd() {
});
}
function meetingIsBreakout() {
const breakouts = Breakouts.find().fetch();
return (breakouts && breakouts.some(b => b.breakoutMeetingId === Auth.meetingID));
}
function wasUserKicked() {
wasKickedDep.depend();
return wasKicked;
@ -137,4 +142,5 @@ export {
clearModal,
getCaptionsStatus,
getFontSize,
meetingIsBreakout,
};

View File

@ -93,15 +93,12 @@ class NavBar extends Component {
renderPresentationTitle() {
const {
meetingId,
currentUserId,
breakouts,
isBreakoutRoom,
presentationTitle,
} = this.props;
const presentationTitle = this.props.presentationTitle;
const breakouts = this.props.breakouts;
const isMeetingBreakout = breakouts.find(b => b.breakoutMeetingId === meetingId);
if (!breakouts.length || isMeetingBreakout) {
if (isBreakoutRoom) {
return (
<h1 className={styles.presentationTitle}>{presentationTitle}</h1>
);
@ -129,9 +126,8 @@ class NavBar extends Component {
componentDidUpdate() {
const {
breakouts,
currentUserId,
meetingId,
getBreakoutJoinURL,
isBreakoutRoom,
} = this.props;
breakouts.forEach(breakout => {
@ -141,8 +137,7 @@ class NavBar extends Component {
const breakoutURL = getBreakoutJoinURL(breakout);
const meetingIsBreakout = meetingId === breakout.breakoutMeetingId;
if (!this.state.didSendBreakoutInvite && !meetingIsBreakout) {
if (!this.state.didSendBreakoutInvite && !isBreakoutRoom) {
this.inviteUserToBreakout(breakout, breakoutURL);
}
});

View File

@ -7,6 +7,7 @@ import Auth from '/imports/ui/services/auth';
import userListService from '../user-list/service';
import ChatService from '../chat/service';
import Service from './service';
import { meetingIsBreakout } from '/imports/ui/components/app/service';
import NavBar from './component';
@ -65,6 +66,7 @@ export default withRouter(createContainer(({ location, router }) => {
getBreakoutJoinURL: Service.getBreakoutJoinURL,
presentationTitle: meetingTitle,
hasUnreadMessages: checkUnreadMessages(),
isBreakoutRoom: meetingIsBreakout(),
beingRecorded: meetingRecorded,
toggleUserList: () => {
if (location.pathname.indexOf('/users') !== -1) {

View File

@ -116,6 +116,7 @@ class UserList extends Component {
currentUser,
userActions,
compact,
isBreakoutRoom,
} = this.props;
return (
@ -146,6 +147,7 @@ class UserList extends Component {
<UserListItem
compact={this.state.compact}
key={user.id}
isBreakoutRoom={isBreakoutRoom}
user={user}
currentUser={currentUser}
userActions={userActions}

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import { meetingIsBreakout } from '/imports/ui/components/app/service';
import Service from './service.js';
import UserList from './component.jsx';
@ -13,6 +14,7 @@ class UserListContainer extends Component {
openChats,
openChat,
userActions,
isBreakoutRoom,
children,
} = this.props;
@ -23,6 +25,7 @@ class UserListContainer extends Component {
currentUser={currentUser}
openChats={openChats}
openChat={openChat}
isBreakoutRoom={isBreakoutRoom}
userActions={userActions}>
{children}
</UserList>
@ -36,4 +39,5 @@ export default createContainer(({ params }) => ({
openChats: Service.getOpenChats(params.chatID),
openChat: params.chatID,
userActions: Service.userActions,
isBreakoutRoom: meetingIsBreakout(),
}), UserListContainer);

View File

@ -102,6 +102,7 @@ class UserListItem extends Component {
user,
userActions,
router,
isBreakoutRoom,
} = this.props;
const {
@ -120,7 +121,7 @@ class UserListItem extends Component {
let allowedToResetStatus = hasAuthority && user.emoji.status != 'none';
// if currentUser is a moderator, allow kicking other users
let allowedToKick = currentUser.isModerator && !user.isCurrent;
let allowedToKick = currentUser.isModerator && !user.isCurrent && !isBreakoutRoom;
let allowedToSetPresenter = (currentUser.isModerator || currentUser.isPresenter) && !user.isPresenter;