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

Fix view source from edit history dialog always showing latest event #10626

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -91,6 +91,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
ViewSource,
{
mxEvent: this.props.mxEvent,
ignoreEdits: true,
},
"mx_Dialog_viewsource",
);
Expand Down