Simplified the toggleSelfVoice code.

This commit is contained in:
Maxim Khlobystov 2018-02-08 14:00:29 -05:00
parent 483f543f17
commit 7968a55bf3
5 changed files with 3 additions and 16 deletions

View File

@ -25,7 +25,6 @@ const propTypes = {
assignPresenter: PropTypes.func.isRequired,
removeUser: PropTypes.func.isRequired,
toggleVoice: PropTypes.func.isRequired,
toggleSelfVoice: PropTypes.func.isRequired,
changeRole: PropTypes.func.isRequired,
roving: PropTypes.func.isRequired,
};
@ -66,7 +65,6 @@ class UserList extends Component {
assignPresenter={this.props.assignPresenter}
removeUser={this.props.removeUser}
toggleVoice={this.props.toggleVoice}
toggleSelfVoice={this.props.toggleSelfVoice}
changeRole={this.props.changeRole}
meeting={this.props.meeting}
getAvailableActions={this.props.getAvailableActions}

View File

@ -20,7 +20,6 @@ const propTypes = {
assignPresenter: PropTypes.func.isRequired,
removeUser: PropTypes.func.isRequired,
toggleVoice: PropTypes.func.isRequired,
toggleSelfVoice: PropTypes.func.isRequired,
changeRole: PropTypes.func.isRequired,
roving: PropTypes.func.isRequired,
};
@ -40,7 +39,6 @@ const UserListContainer = (props) => {
assignPresenter,
removeUser,
toggleVoice,
toggleSelfVoice,
changeRole,
roving,
} = props;
@ -56,7 +54,6 @@ const UserListContainer = (props) => {
assignPresenter={assignPresenter}
removeUser={removeUser}
toggleVoice={toggleVoice}
toggleSelfVoice={toggleSelfVoice}
changeRole={changeRole}
getAvailableActions={getAvailableActions}
normalizeEmojiName={normalizeEmojiName}
@ -83,7 +80,6 @@ export default withTracker(({ params }) => ({
assignPresenter: Service.assignPresenter,
removeUser: Service.removeUser,
toggleVoice: Service.toggleVoice,
toggleSelfVoice: Service.toggleSelfVoice,
changeRole: Service.changeRole,
roving: Service.roving,
}))(UserListContainer);

View File

@ -309,9 +309,7 @@ const removeUser = (userId) => {
}
};
const toggleVoice = (userId) => { makeCall('toggleVoice', userId); };
const toggleSelfVoice = () => { makeCall('toggleSelfVoice'); };
const toggleVoice = (userId) => { userId === Auth.userID ? makeCall('toggleSelfVoice') : makeCall('toggleVoice', userId); };
const changeRole = (userId, role) => { makeCall('changeRole', userId, role); };
@ -356,7 +354,6 @@ export default {
assignPresenter,
removeUser,
toggleVoice,
toggleSelfVoice,
changeRole,
getUsers,
getOpenChats,

View File

@ -22,7 +22,6 @@ const propTypes = {
assignPresenter: PropTypes.func.isRequired,
removeUser: PropTypes.func.isRequired,
toggleVoice: PropTypes.func.isRequired,
toggleSelfVoice: PropTypes.func.isRequired,
changeRole: PropTypes.func.isRequired,
roving: PropTypes.func.isRequired,
};
@ -60,7 +59,6 @@ class UserContent extends Component {
assignPresenter={this.props.assignPresenter}
removeUser={this.props.removeUser}
toggleVoice={this.props.toggleVoice}
toggleSelfVoice={this.props.toggleSelfVoice}
changeRole={this.props.changeRole}
getAvailableActions={this.props.getAvailableActions}
normalizeEmojiName={this.props.normalizeEmojiName}

View File

@ -19,7 +19,6 @@ const propTypes = {
assignPresenter: PropTypes.func.isRequired,
removeUser: PropTypes.func.isRequired,
toggleVoice: PropTypes.func.isRequired,
toggleSelfVoice: PropTypes.func.isRequired,
changeRole: PropTypes.func.isRequired,
getAvailableActions: PropTypes.func.isRequired,
normalizeEmojiName: PropTypes.func.isRequired,
@ -143,7 +142,6 @@ class UserParticipants extends Component {
setEmojiStatus,
removeUser,
toggleVoice,
toggleSelfVoice,
} = this.props;
const userActions =
@ -170,12 +168,12 @@ class UserParticipants extends Component {
},
mute: {
label: () => intl.formatMessage(intlMessages.MuteUserAudioLabel),
handler: (user) => { user.id == currentUser.id ? toggleSelfVoice() : toggleVoice(user.id); },
handler: (user) => toggleVoice(user.id),
icon: 'audio_off',
},
unmute: {
label: () => intl.formatMessage(intlMessages.UnmuteUserAudioLabel),
handler: (user) => { user.id == currentUser.id ? toggleSelfVoice() : toggleVoice(user.id); },
handler: (user) => toggleVoice(user.id),
icon: 'audio_on',
},
promote: {