When we only show one compose button, show upload (#7165)

This commit is contained in:
Andy Balaam 2021-11-19 14:01:07 +00:00 committed by GitHub
parent bd09fc2231
commit a2c662272e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -472,6 +472,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
}; };
private renderButtons(menuPosition): JSX.Element | JSX.Element[] { private renderButtons(menuPosition): JSX.Element | JSX.Element[] {
let uploadButtonIndex = 0;
const buttons: JSX.Element[] = []; const buttons: JSX.Element[] = [];
if (!this.state.haveRecording) { if (!this.state.haveRecording) {
if (SettingsStore.getValue("feature_polls")) { if (SettingsStore.getValue("feature_polls")) {
@ -479,6 +480,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
<PollButton key="polls" room={this.props.room} />, <PollButton key="polls" room={this.props.room} />,
); );
} }
uploadButtonIndex = buttons.length;
buttons.push( buttons.push(
<UploadButton <UploadButton
key="controls_upload" key="controls_upload"
@ -528,7 +530,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
}); });
return <> return <>
{ buttons[0] } { buttons[uploadButtonIndex] }
<AccessibleTooltipButton <AccessibleTooltipButton
className={classnames} className={classnames}
onClick={this.toggleButtonMenu} onClick={this.toggleButtonMenu}