From 270a26d89a867eb728183fa8ddf76ed3c1ded32f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 17 Apr 2023 17:09:17 +0100 Subject: [PATCH] Fix view source from edit history dialog always showing latest event (#10626) --- src/components/structures/ViewSource.tsx | 7 ++++++- src/components/views/messages/EditHistoryMessage.tsx | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/structures/ViewSource.tsx b/src/components/structures/ViewSource.tsx index bf1115c00f..a0a500810f 100644 --- a/src/components/structures/ViewSource.tsx +++ b/src/components/structures/ViewSource.tsx @@ -31,6 +31,7 @@ import CopyableText from "../views/elements/CopyableText"; interface IProps { mxEvent: MatrixEvent; // the MatrixEvent associated with the context menu + ignoreEdits?: boolean; onFinished(): void; } @@ -58,7 +59,11 @@ export default class ViewSource extends React.Component { // returns the dialog body for viewing the event source private viewSourceContent(): JSX.Element { - const mxEvent = this.props.mxEvent.replacingEvent() || this.props.mxEvent; // show the replacing event, not the original, if it is an edit + let mxEvent = this.props.mxEvent.replacingEvent() || this.props.mxEvent; // show the replacing event, not the original, if it is an edit + if (this.props.ignoreEdits) { + mxEvent = this.props.mxEvent; + } + const isEncrypted = mxEvent.isEncrypted(); // @ts-ignore const decryptedEventSource = mxEvent.clearEvent; // FIXME: clearEvent is private diff --git a/src/components/views/messages/EditHistoryMessage.tsx b/src/components/views/messages/EditHistoryMessage.tsx index 930c6d7b9d..54f24973c5 100644 --- a/src/components/views/messages/EditHistoryMessage.tsx +++ b/src/components/views/messages/EditHistoryMessage.tsx @@ -92,6 +92,7 @@ export default class EditHistoryMessage extends React.PureComponent