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
pull/21833/head
J. Ryan Stinnett 2020-01-20 12:06:43 +00:00
parent d35788476a
commit 15749621a5
1 changed files with 25 additions and 26 deletions

View File

@ -23,6 +23,7 @@ import * as sdk from '../../../index';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import sendBugReport from '../../../rageshake/submit-rageshake';
export default class BugReportDialog extends React.Component { export default class BugReportDialog extends React.Component {
constructor(props) { constructor(props) {
@ -67,32 +68,30 @@ export default class BugReportDialog extends React.Component {
this.setState({ busy: true, progress: null, err: null }); this.setState({ busy: true, progress: null, err: null });
this._sendProgressCallback(_t("Preparing to send logs")); this._sendProgressCallback(_t("Preparing to send logs"));
require(['../../../rageshake/submit-rageshake'], (s) => { sendBugReport(SdkConfig.get().bug_report_endpoint_url, {
s(SdkConfig.get().bug_report_endpoint_url, { userText,
userText, sendLogs: true,
sendLogs: true, progressCallback: this._sendProgressCallback,
progressCallback: this._sendProgressCallback, label: this.props.label,
label: this.props.label, }).then(() => {
}).then(() => { if (!this._unmounted) {
if (!this._unmounted) { this.props.onFinished(false);
this.props.onFinished(false); const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); // N.B. first param is passed to piwik and so doesn't want i18n
// N.B. first param is passed to piwik and so doesn't want i18n Modal.createTrackedDialog('Bug report sent', '', QuestionDialog, {
Modal.createTrackedDialog('Bug report sent', '', QuestionDialog, { title: _t('Logs sent'),
title: _t('Logs sent'), description: _t('Thank you!'),
description: _t('Thank you!'), hasCancelButton: false,
hasCancelButton: false, });
}); }
} }, (err) => {
}, (err) => { if (!this._unmounted) {
if (!this._unmounted) { this.setState({
this.setState({ busy: false,
busy: false, progress: null,
progress: null, err: _t("Failed to send logs: ") + `${err.message}`,
err: _t("Failed to send logs: ") + `${err.message}`, });
}); }
}
});
}); });
} }