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 MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput");
const callInProgress = this.props.callState && this.props.callState !== 'ended';
const controls = [
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,
];
let callButton;
let videoCallButton;
let hangupButton;
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) {
// This also currently includes the call buttons. Really we should
@ -367,9 +358,9 @@ export default class MessageComposer extends React.Component {
formattingButton,
stickerpickerButton,
uploadButton,
hangupButton,
callButton,
videoCallButton,
callInProgress ? <HangupButton key="controls_hangup" roomId={this.props.room.roomId} /> : null,
callInProgress ? null : <CallButton key="controls_call" roomId={this.props.room.roomId} />,
callInProgress ? null : <VideoCallButton key="controls_videocall" roomId={this.props.room.roomId} />,
);
} else if (this.state.tombstone) {
const replacementRoomId = this.state.tombstone.getContent()['replacement_room'];