Tighten up code around call buttons

Signed-off-by: YaoiFangirl420 <48789208+YaoiFangirl420@users.noreply.github.com>
pull/21833/head
YaoiFangirl420 2019-04-06 20:48:13 -07:00
parent 6aa9f068b3
commit cfb9172121
1 changed files with 5 additions and 14 deletions

View File

@ -293,23 +293,14 @@ export default class MessageComposer extends React.Component {
const uploadInputStyle = {display: 'none'}; const uploadInputStyle = {display: 'none'};
const MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput"); const MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput");
const callInProgress = this.props.callState && this.props.callState !== 'ended';
const controls = [ const controls = [
this.state.me ? <Avatar key="controls_avatar" me={this.state.me} /> : null, this.state.me ? <Avatar key="controls_avatar" me={this.state.me} /> : null,
this.props.e2eStatus ? <E2EIcon key="e2eIcon" status={this.props.e2eStatus} className="mx_MessageComposer_e2eIcon" /> : null, this.props.e2eStatus ? <E2EIcon key="e2eIcon" status={this.props.e2eStatus} className="mx_MessageComposer_e2eIcon" /> : null,
]; ];
let callButton;
let videoCallButton;
let hangupButton;
const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
// Call buttons
if (this.props.callState && this.props.callState !== 'ended') {
hangupButton = <HangupButton key="controls_hangup" roomId={this.props.room.roomId} />;
} else {
callButton = <CallButton key="controls_call" roomId={this.props.room.roomId} />;
videoCallButton = <VideoCallButton key="controls_videocall" roomId={this.props.room.roomId} />;
}
if (!this.state.tombstone && this.state.canSendMessages) { if (!this.state.tombstone && this.state.canSendMessages) {
// This also currently includes the call buttons. Really we should // This also currently includes the call buttons. Really we should
@ -367,9 +358,9 @@ export default class MessageComposer extends React.Component {
formattingButton, formattingButton,
stickerpickerButton, stickerpickerButton,
uploadButton, uploadButton,
hangupButton, callInProgress ? <HangupButton key="controls_hangup" roomId={this.props.room.roomId} /> : null,
callButton, callInProgress ? null : <CallButton key="controls_call" roomId={this.props.room.roomId} />,
videoCallButton, callInProgress ? null : <VideoCallButton key="controls_videocall" roomId={this.props.room.roomId} />,
); );
} else if (this.state.tombstone) { } else if (this.state.tombstone) {
const replacementRoomId = this.state.tombstone.getContent()['replacement_room']; const replacementRoomId = this.state.tombstone.getContent()['replacement_room'];