Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix view source from edit history dialog always showing latest event (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Apr 17, 2023
1 parent a092a91 commit 270a26d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/structures/ViewSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -58,7 +59,11 @@ export default class ViewSource extends React.Component<IProps, IState> {

// 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
Expand Down
1 change: 1 addition & 0 deletions src/components/views/messages/EditHistoryMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
ViewSource,
{
mxEvent: this.props.mxEvent,
ignoreEdits: true,
},
"mx_Dialog_viewsource",
);
Expand Down

0 comments on commit 270a26d

Please sign in to comment.