mirror of https://github.com/vector-im/riot-web
Fix showing events which were replied to and then redacted
parent
831da696ad
commit
6589e5dab9
|
@ -176,6 +176,9 @@ export default class ReplyThread extends React.Component {
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.unmounted = false;
|
this.unmounted = false;
|
||||||
this.room = this.context.matrixClient.getRoom(this.props.parentEv.getRoomId());
|
this.room = this.context.matrixClient.getRoom(this.props.parentEv.getRoomId());
|
||||||
|
this.room.on("Room.redaction", this.onRoomRedaction);
|
||||||
|
// same event handler as Room.redaction as for both we just do forceUpdate
|
||||||
|
this.room.on("Room.redactionCancelled", this.onRoomRedaction);
|
||||||
this.initialize();
|
this.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +188,20 @@ export default class ReplyThread extends React.Component {
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.unmounted = true;
|
this.unmounted = true;
|
||||||
|
if (this.room) {
|
||||||
|
this.room.removeListener("Room.redaction", this.onRoomRedaction);
|
||||||
|
this.room.removeListener("Room.redactionCancelled", this.onRoomRedaction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onRoomRedaction = (ev, room) => {
|
||||||
|
if (this.unmounted) return;
|
||||||
|
|
||||||
|
// we could skip an update if the event isn't in our timeline,
|
||||||
|
// but that's probably an early optimisation.
|
||||||
|
this.forceUpdate();
|
||||||
|
};
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
const {parentEv} = this.props;
|
const {parentEv} = this.props;
|
||||||
// at time of making this component we checked that props.parentEv has a parentEventId
|
// at time of making this component we checked that props.parentEv has a parentEventId
|
||||||
|
@ -298,11 +313,13 @@ export default class ReplyThread extends React.Component {
|
||||||
|
|
||||||
return <blockquote className="mx_ReplyThread" key={ev.getId()}>
|
return <blockquote className="mx_ReplyThread" key={ev.getId()}>
|
||||||
{ dateSep }
|
{ dateSep }
|
||||||
<EventTile mxEvent={ev}
|
<EventTile
|
||||||
tileShape="reply"
|
mxEvent={ev}
|
||||||
onHeightChanged={this.props.onHeightChanged}
|
tileShape="reply"
|
||||||
permalinkCreator={this.props.permalinkCreator}
|
onHeightChanged={this.props.onHeightChanged}
|
||||||
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")} />
|
permalinkCreator={this.props.permalinkCreator}
|
||||||
|
isRedacted={ev.isRedacted()}
|
||||||
|
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")} />
|
||||||
</blockquote>;
|
</blockquote>;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue