1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-20 16:22:28 +03:00

Merge pull request #2710 from matrix-org/t3chguy/composer_demote

move canSendMessages into state so that it will re-render the composer
This commit is contained in:
Michael Telatynski
2019-02-27 15:40:00 +00:00
committed by GitHub

View File

@@ -68,6 +68,7 @@ export default class MessageComposer extends React.Component {
showFormatting: SettingsStore.getValue('MessageComposer.showFormatting'),
isQuoting: Boolean(RoomViewStore.getQuotingEvent()),
tombstone: this._getRoomTombstone(),
canSendMessages: this.props.room.maySendMessage(),
};
}
@@ -120,6 +121,9 @@ export default class MessageComposer extends React.Component {
if (ev.getType() === 'm.room.tombstone') {
this.setState({tombstone: this._getRoomTombstone()});
}
if (ev.getType() === 'm.room.power_levels') {
this.setState({canSendMessages: this.props.room.maySendMessage()});
}
}
_getRoomTombstone() {
@@ -359,10 +363,7 @@ export default class MessageComposer extends React.Component {
</AccessibleButton>;
}
const canSendMessages = !this.state.tombstone &&
this.props.room.maySendMessage();
if (canSendMessages) {
if (!this.state.tombstone && this.state.canSendMessages) {
// This also currently includes the call buttons. Really we should
// check separately for whether we can call, but this is slightly
// complex because of conference calls.