From 24b5f80a7d2855eb8eb63933b1c4727f5b3234f5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 17 Apr 2023 09:51:32 +0100 Subject: [PATCH] Fix view source from edit history dialog always showing latest event --- 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 bf1115c00f1..a0a500810f6 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 421673d7711..6e686cc1a5e 100644 --- a/src/components/views/messages/EditHistoryMessage.tsx +++ b/src/components/views/messages/EditHistoryMessage.tsx @@ -91,6 +91,7 @@ export default class EditHistoryMessage extends React.PureComponent