mirror of https://github.com/vector-im/riot-web
Merge pull request #5212 from matrix-org/t3chguy/fix/15172
Also hide bug reporting prompts from the Error Boundariespull/21833/head
commit
4e2b6c2a30
|
@ -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>);
|
||||||
|
|
|
@ -1440,8 +1440,8 @@
|
||||||
"Click to view edits": "Click to view edits",
|
"Click to view edits": "Click to view edits",
|
||||||
"Edited at %(date)s. Click to view edits.": "Edited at %(date)s. Click to view edits.",
|
"Edited at %(date)s. Click to view edits.": "Edited at %(date)s. Click to view edits.",
|
||||||
"edited": "edited",
|
"edited": "edited",
|
||||||
"Can't load this message": "Can't load this message",
|
|
||||||
"Submit logs": "Submit logs",
|
"Submit logs": "Submit logs",
|
||||||
|
"Can't load this message": "Can't load this message",
|
||||||
"Failed to load group members": "Failed to load group members",
|
"Failed to load group members": "Failed to load group members",
|
||||||
"Filter community members": "Filter community members",
|
"Filter community members": "Filter community members",
|
||||||
"Are you sure you want to remove '%(roomName)s' from %(groupId)s?": "Are you sure you want to remove '%(roomName)s' from %(groupId)s?",
|
"Are you sure you want to remove '%(roomName)s' from %(groupId)s?": "Are you sure you want to remove '%(roomName)s' from %(groupId)s?",
|
||||||
|
|
Loading…
Reference in New Issue