mirror of https://github.com/vector-im/riot-web
Handle event edits
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
866a11d7e3
commit
75e7948ca8
|
@ -45,11 +45,14 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.mxEvent.on("Event.decrypted", this.onDecrypted);
|
this.props.mxEvent.on("Event.decrypted", this.onDecrypted);
|
||||||
this.props.mxEvent.on("Event.beforeRedaction", this.onBeforeRedaction);
|
this.props.mxEvent.on("Event.beforeRedaction", this.onEventRequiresUpdate);
|
||||||
|
this.props.mxEvent.on("Event.replaced", this.onEventRequiresUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.props.mxEvent.removeListener("Event.decrypted", this.onDecrypted);
|
this.props.mxEvent.removeListener("Event.decrypted", this.onDecrypted);
|
||||||
|
this.props.mxEvent.removeListener("Event.beforeRedaction", this.onEventRequiresUpdate);
|
||||||
|
this.props.mxEvent.removeListener("Event.replaced", this.onEventRequiresUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onDecrypted = (): void => {
|
private onDecrypted = (): void => {
|
||||||
|
@ -59,8 +62,8 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private onBeforeRedaction = (): void => {
|
private onEventRequiresUpdate = (): void => {
|
||||||
// When the event gets redacted, update it, so that a different tile handler is used
|
// Force update when necessary - redactions and edits
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -155,6 +158,7 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
showUrlPreview={false}
|
showUrlPreview={false}
|
||||||
overrideBodyTypes={msgtypeOverrides}
|
overrideBodyTypes={msgtypeOverrides}
|
||||||
overrideEventTypes={evOverrides}
|
overrideEventTypes={evOverrides}
|
||||||
|
replacingEventId={this.props.mxEvent.replacingEventId()}
|
||||||
maxImageHeight={96} />
|
maxImageHeight={96} />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue