Remove replies from hidden events when shown with `messages.ViewSourceEvent` (#6796)

As discovered in https://github.com/vector-im/element-web/issues/10391#is

Previously, if you turned on the `showHiddenEventsInTimeline` labs flag, edit (`m.replace`) events
that also have a `m.in_reply_to` field, will show the reply in the timeline.

ex.
```
{
  "type": "m.room.message",
  "content": {
    "body": " * foo",
    "msgtype": "m.text",
    "m.new_content": {
      "body": "foo",
      "msgtype": "m.text"
    },
    "m.relates_to": {
      "rel_type": "m.replace",
      "event_id": "$yvuev9bF2nLRf8fscG55njpVjY3FHJzWgZ4BKI9_0eg",
      "m.in_reply_to": {
        "event_id": "$qkjmFBTEc0VvfVyzq1CJuh1QZi_xDIgNEFjZ4Pq34og"
      }
    }
  }
}
```
pull/21833/head
Eric Eastwood 2021-09-14 12:28:28 -05:00 committed by GitHub
parent 85fea9cfd0
commit fddc20dd89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 8 deletions

View File

@ -1192,7 +1192,11 @@ export default class EventTile extends React.Component<IProps, IState> {
}
default: {
const thread = ReplyThread.makeThread(
let thread;
// When the "showHiddenEventsInTimeline" lab is enabled,
// avoid showing replies for hidden events (events without tiles)
if (haveTileForEvent(this.props.mxEvent)) {
thread = ReplyThread.makeThread(
this.props.mxEvent,
this.props.onHeightChanged,
this.props.permalinkCreator,
@ -1200,6 +1204,7 @@ export default class EventTile extends React.Component<IProps, IState> {
this.props.layout,
this.props.alwaysShowTimestamps || this.state.hover,
);
}
const isOwnEvent = this.props.mxEvent?.sender?.userId === MatrixClientPeg.get().getUserId();