From 324774ec2f6103fd6246a80f8fc60abe0f65e1dd Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 20 Mar 2018 10:52:50 +0000 Subject: [PATCH] Reword the BugReportDialog.js as per @lampholder See https://github.com/matrix-org/matrix-react-sdk/pull/1740#issuecomment-369597662 --- .../views/dialogs/BugReportDialog.js | 96 +++++++++++++------ src/i18n/strings/en_EN.json | 18 ++-- .../views/dialogs/_BugReportDialog.scss | 38 +++++++- 3 files changed, 110 insertions(+), 42 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js index 849d32f851..95b5a6a068 100644 --- a/src/components/views/dialogs/BugReportDialog.js +++ b/src/components/views/dialogs/BugReportDialog.js @@ -27,6 +27,7 @@ export default class BugReportDialog extends React.Component { sendLogs: true, busy: false, err: null, + issueUrl: "", text: "", progress: null, }; @@ -34,6 +35,7 @@ export default class BugReportDialog extends React.Component { this._onSubmit = this._onSubmit.bind(this); this._onCancel = this._onCancel.bind(this); this._onTextChange = this._onTextChange.bind(this); + this._onIssueUrlChange = this._onIssueUrlChange.bind(this); this._onSendLogsChange = this._onSendLogsChange.bind(this); this._sendProgressCallback = this._sendProgressCallback.bind(this); } @@ -47,28 +49,24 @@ export default class BugReportDialog extends React.Component { } _onSubmit(ev) { - const sendLogs = this.state.sendLogs; - const userText = this.state.text; - if (!sendLogs && userText.trim().length === 0) { - this.setState({ - err: _t("Please describe the bug and/or send logs."), - }); - return; - } + const userText = + (this.state.text.length > 0 ? this.state.text + '\n\n': '') + 'Issue: ' + + (this.state.issueUrl.length > 0 ? this.state.issueUrl : 'No issue link given'); + this.setState({ busy: true, progress: null, err: null }); - this._sendProgressCallback(_t("Loading bug report module")); + this._sendProgressCallback(_t("Preparing to send logs")); require(['../../../vector/submit-rageshake'], (s) => { s(SdkConfig.get().bug_report_endpoint_url, { - userText: userText, - sendLogs: sendLogs, + userText, + sendLogs: true, progressCallback: this._sendProgressCallback, }).then(() => { if (!this._unmounted) { this.props.onFinished(false); const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); Modal.createTrackedDialog('Bug report sent', '', QuestionDialog, { - title: _t('Bug report sent'), + title: _t('Logs sent'), description: _t('Thank you!'), hasCancelButton: false, }); @@ -78,7 +76,7 @@ export default class BugReportDialog extends React.Component { this.setState({ busy: false, progress: null, - err: _t("Failed to send report: ") + `${err.message}`, + err: _t("Failed to send logs: ") + `${err.message}`, }); } }); @@ -89,7 +87,11 @@ export default class BugReportDialog extends React.Component { this.setState({ text: ev.target.value }); } - _onSendLogsChange(ev) { + _onIssueUrlChange(ev) { + this.setState({ issueUrl: ev.target.value }); + } + + _onSendLogsChange(ev) { this.setState({ sendLogs: ev.target.checked }); } @@ -130,27 +132,61 @@ export default class BugReportDialog extends React.Component { return (
- { _t("Report a bug") } + { _t("Submit debug logs") }

- { _t("Please describe the bug. What did you do? What did you expect to happen? What actually happened?") } + { _t( + "Debug logs contain application usage data including your " + + "username, the IDs or aliases of the rooms or groups you " + + "have visited and the usernames of other users. They do " + + "not contain messages.", + ) }

-