From 15749621a51d797d61960bb83d70f64c1f3c43a8 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 20 Jan 2020 12:06:43 +0000 Subject: [PATCH] Fix rageshake submission after build changes We aren't able to depend on `require` in this context anymore. Fixes https://github.com/vector-im/riot-web/issues/11938 --- .../views/dialogs/BugReportDialog.js | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js index ccb332fa60..fe95041373 100644 --- a/src/components/views/dialogs/BugReportDialog.js +++ b/src/components/views/dialogs/BugReportDialog.js @@ -23,6 +23,7 @@ import * as sdk from '../../../index'; import SdkConfig from '../../../SdkConfig'; import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; +import sendBugReport from '../../../rageshake/submit-rageshake'; export default class BugReportDialog extends React.Component { constructor(props) { @@ -67,32 +68,30 @@ export default class BugReportDialog extends React.Component { this.setState({ busy: true, progress: null, err: null }); this._sendProgressCallback(_t("Preparing to send logs")); - require(['../../../rageshake/submit-rageshake'], (s) => { - s(SdkConfig.get().bug_report_endpoint_url, { - userText, - sendLogs: true, - progressCallback: this._sendProgressCallback, - label: this.props.label, - }).then(() => { - if (!this._unmounted) { - this.props.onFinished(false); - const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); - // N.B. first param is passed to piwik and so doesn't want i18n - Modal.createTrackedDialog('Bug report sent', '', QuestionDialog, { - title: _t('Logs sent'), - description: _t('Thank you!'), - hasCancelButton: false, - }); - } - }, (err) => { - if (!this._unmounted) { - this.setState({ - busy: false, - progress: null, - err: _t("Failed to send logs: ") + `${err.message}`, - }); - } - }); + sendBugReport(SdkConfig.get().bug_report_endpoint_url, { + userText, + sendLogs: true, + progressCallback: this._sendProgressCallback, + label: this.props.label, + }).then(() => { + if (!this._unmounted) { + this.props.onFinished(false); + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + // N.B. first param is passed to piwik and so doesn't want i18n + Modal.createTrackedDialog('Bug report sent', '', QuestionDialog, { + title: _t('Logs sent'), + description: _t('Thank you!'), + hasCancelButton: false, + }); + } + }, (err) => { + if (!this._unmounted) { + this.setState({ + busy: false, + progress: null, + err: _t("Failed to send logs: ") + `${err.message}`, + }); + } }); }