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

This commit is contained in:
Michael Telatynski 2023-04-17 17:09:17 +01:00 committed by GitHub
parent a092a91cd9
commit 270a26d89a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -31,6 +31,7 @@ import CopyableText from "../views/elements/CopyableText";
interface IProps { interface IProps {
mxEvent: MatrixEvent; // the MatrixEvent associated with the context menu mxEvent: MatrixEvent; // the MatrixEvent associated with the context menu
ignoreEdits?: boolean;
onFinished(): void; onFinished(): void;
} }
@ -58,7 +59,11 @@ export default class ViewSource extends React.Component<IProps, IState> {
// returns the dialog body for viewing the event source // returns the dialog body for viewing the event source
private viewSourceContent(): JSX.Element { 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(); const isEncrypted = mxEvent.isEncrypted();
// @ts-ignore // @ts-ignore
const decryptedEventSource = mxEvent.clearEvent; // FIXME: clearEvent is private const decryptedEventSource = mxEvent.clearEvent; // FIXME: clearEvent is private

View file

@ -92,6 +92,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
ViewSource, ViewSource,
{ {
mxEvent: this.props.mxEvent, mxEvent: this.props.mxEvent,
ignoreEdits: true,
}, },
"mx_Dialog_viewsource", "mx_Dialog_viewsource",
); );