You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Make event subscriptions conditional when needed
This commit is contained in:
@@ -114,15 +114,19 @@ export default class MessageActionBar extends React.PureComponent {
|
|||||||
static contextType = RoomContext;
|
static contextType = RoomContext;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.mxEvent.on("Event.decrypted", this.onDecrypted);
|
if (this.props.mxEvent.isBeingDecrypted()) {
|
||||||
|
this.props.mxEvent.once("Event.decrypted", this.onDecrypted);
|
||||||
|
}
|
||||||
this.props.mxEvent.on("Event.beforeRedaction", this.onBeforeRedaction);
|
this.props.mxEvent.on("Event.beforeRedaction", this.onBeforeRedaction);
|
||||||
this.props.mxEvent.on("Event.localEventIdReplaced", this.onEcho);
|
if (this.props.mxEvent.getId()[0] !== "!") {
|
||||||
|
this.props.mxEvent.once("Event.localEventIdReplaced", this.onEcho);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.props.mxEvent.removeListener("Event.decrypted", this.onDecrypted);
|
this.props.mxEvent.off("Event.decrypted", this.onDecrypted);
|
||||||
this.props.mxEvent.removeListener("Event.beforeRedaction", this.onBeforeRedaction);
|
this.props.mxEvent.off("Event.beforeRedaction", this.onBeforeRedaction);
|
||||||
this.props.mxEvent.removeListener("Event.localEventIdReplaced", this.onEcho);
|
this.props.mxEvent.off("Event.localEventIdReplaced", this.onEcho);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDecrypted = () => {
|
onDecrypted = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user