diff --git a/src/components/views/messages/TileErrorBoundary.tsx b/src/components/views/messages/TileErrorBoundary.tsx index ac84562cf9..16b32f5f06 100644 --- a/src/components/views/messages/TileErrorBoundary.tsx +++ b/src/components/views/messages/TileErrorBoundary.tsx @@ -1,5 +1,5 @@ /* -Copyright 2020 - 2021 The Matrix.org Foundation C.I.C. +Copyright 2020 - 2022 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ import SdkConfig from "../../../SdkConfig"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import BugReportDialog from '../dialogs/BugReportDialog'; import AccessibleButton from '../elements/AccessibleButton'; +import SettingsStore from "../../../settings/SettingsStore"; +import ViewSource from "../../structures/ViewSource"; interface IProps { mxEvent: MatrixEvent; @@ -56,6 +58,12 @@ export default class TileErrorBoundary extends React.Component { }); }; + private onViewSource = (): void => { + Modal.createTrackedDialog('View Event Source', 'from crash', ViewSource, { + mxEvent: this.props.mxEvent, + }, 'mx_Dialog_viewsource'); + }; + render() { if (this.state.error) { const { mxEvent } = this.props; @@ -73,12 +81,20 @@ export default class TileErrorBoundary extends React.Component { ; } + let viewSourceButton; + if (mxEvent && SettingsStore.getValue("developerMode")) { + viewSourceButton = + { _t("View Source") } + ; + } + return (
{ _t("Can't load this message") } { mxEvent && ` (${mxEvent.getType()})` } { submitLogsButton } + { viewSourceButton }
);