Enable the polls feature (#7581)

This commit is contained in:
Andy Balaam 2022-01-20 09:40:47 +00:00 committed by GitHub
parent a7a7cb56fe
commit c4fc20018d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 59 deletions

View file

@ -253,7 +253,6 @@ interface IState {
isMenuOpen: boolean;
showStickers: boolean;
showStickersButton: boolean;
showPollsButton: boolean;
showLocationButton: boolean;
}
@ -285,7 +284,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
isMenuOpen: false,
showStickers: false,
showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
showPollsButton: SettingsStore.getValue("feature_polls"),
showLocationButton: SettingsStore.getValue("MessageComposerInput.showLocationButton"),
};
@ -293,7 +291,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null);
SettingsStore.monitorSetting("MessageComposerInput.showLocationButton", null);
SettingsStore.monitorSetting("feature_polls", null);
SettingsStore.monitorSetting("feature_location_share", null);
}
@ -341,14 +338,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
break;
}
case "feature_polls": {
const showPollsButton = SettingsStore.getValue("feature_polls");
if (this.state.showPollsButton !== showPollsButton) {
this.setState({ showPollsButton });
}
break;
}
case "MessageComposerInput.showLocationButton":
case "feature_location_share": {
const showLocationButton = SettingsStore.getValue(
@ -519,11 +508,13 @@ export default class MessageComposer extends React.Component<IProps, IState> {
let uploadButtonIndex = 0;
const buttons: JSX.Element[] = [];
if (!this.state.haveRecording) {
if (this.state.showPollsButton) {
buttons.push(
<PollButton key="polls" room={this.props.room} narrowMode={this.state.narrowMode} />,
);
}
buttons.push(
<PollButton
key="polls"
room={this.props.room}
narrowMode={this.state.narrowMode}
/>,
);
uploadButtonIndex = buttons.length;
buttons.push(
<UploadButton key="controls_upload" roomId={this.props.room.roomId} relation={this.props.relation} />,