mirror of https://github.com/vector-im/riot-web
Also hide bug reporting prompts from the Error Boundaries
parent
16d8ea184d
commit
caef9b27a0
|
@ -20,6 +20,7 @@ import { _t } from '../../../languageHandler';
|
||||||
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
||||||
import PlatformPeg from '../../../PlatformPeg';
|
import PlatformPeg from '../../../PlatformPeg';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
|
import SdkConfig from "../../../SdkConfig";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error boundary component can be used to wrap large content areas and
|
* This error boundary component can be used to wrap large content areas and
|
||||||
|
@ -73,9 +74,10 @@ export default class ErrorBoundary extends React.PureComponent {
|
||||||
if (this.state.error) {
|
if (this.state.error) {
|
||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
const newIssueUrl = "https://github.com/vector-im/element-web/issues/new";
|
const newIssueUrl = "https://github.com/vector-im/element-web/issues/new";
|
||||||
return <div className="mx_ErrorBoundary">
|
|
||||||
<div className="mx_ErrorBoundary_body">
|
let bugReportSection;
|
||||||
<h1>{_t("Something went wrong!")}</h1>
|
if (SdkConfig.get().bug_report_endpoint_url) {
|
||||||
|
bugReportSection = <React.Fragment>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Please <newIssueLink>create a new issue</newIssueLink> " +
|
"Please <newIssueLink>create a new issue</newIssueLink> " +
|
||||||
"on GitHub so that we can investigate this bug.", {}, {
|
"on GitHub so that we can investigate this bug.", {}, {
|
||||||
|
@ -94,6 +96,13 @@ export default class ErrorBoundary extends React.PureComponent {
|
||||||
<AccessibleButton onClick={this._onBugReport} kind='primary'>
|
<AccessibleButton onClick={this._onBugReport} kind='primary'>
|
||||||
{_t("Submit debug logs")}
|
{_t("Submit debug logs")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
|
</React.Fragment>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <div className="mx_ErrorBoundary">
|
||||||
|
<div className="mx_ErrorBoundary_body">
|
||||||
|
<h1>{_t("Something went wrong!")}</h1>
|
||||||
|
{ bugReportSection }
|
||||||
<AccessibleButton onClick={this._onClearCacheAndReload} kind='danger'>
|
<AccessibleButton onClick={this._onClearCacheAndReload} kind='danger'>
|
||||||
{_t("Clear cache and reload")}
|
{_t("Clear cache and reload")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
|
|
|
@ -19,6 +19,7 @@ import classNames from 'classnames';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
|
import SdkConfig from "../../../SdkConfig";
|
||||||
|
|
||||||
export default class TileErrorBoundary extends React.Component {
|
export default class TileErrorBoundary extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -54,14 +55,20 @@ export default class TileErrorBoundary extends React.Component {
|
||||||
mx_EventTile_content: true,
|
mx_EventTile_content: true,
|
||||||
mx_EventTile_tileError: true,
|
mx_EventTile_tileError: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let submitLogsButton;
|
||||||
|
if (SdkConfig.get().bug_report_endpoint_url) {
|
||||||
|
submitLogsButton = <a onClick={this._onBugReport} href="#">
|
||||||
|
{_t("Submit logs")}
|
||||||
|
</a>;
|
||||||
|
}
|
||||||
|
|
||||||
return (<div className={classNames(classes)}>
|
return (<div className={classNames(classes)}>
|
||||||
<div className="mx_EventTile_line">
|
<div className="mx_EventTile_line">
|
||||||
<span>
|
<span>
|
||||||
{_t("Can't load this message")}
|
{_t("Can't load this message")}
|
||||||
{ mxEvent && ` (${mxEvent.getType()})` }
|
{ mxEvent && ` (${mxEvent.getType()})` }
|
||||||
<a onClick={this._onBugReport} href="#">
|
{ submitLogsButton }
|
||||||
{_t("Submit logs")}
|
|
||||||
</a>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>);
|
</div>);
|
||||||
|
|
Loading…
Reference in New Issue