Skip to content

Commit 324774e

Browse files
committed
Reword the BugReportDialog.js as per @lampholder
See matrix-org/matrix-react-sdk#1740 (comment)
1 parent 8853496 commit 324774e

File tree

3 files changed

+110
-42
lines changed

3 files changed

+110
-42
lines changed

src/components/views/dialogs/BugReportDialog.js

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ export default class BugReportDialog extends React.Component {
2727
sendLogs: true,
2828
busy: false,
2929
err: null,
30+
issueUrl: "",
3031
text: "",
3132
progress: null,
3233
};
3334
this._unmounted = false;
3435
this._onSubmit = this._onSubmit.bind(this);
3536
this._onCancel = this._onCancel.bind(this);
3637
this._onTextChange = this._onTextChange.bind(this);
38+
this._onIssueUrlChange = this._onIssueUrlChange.bind(this);
3739
this._onSendLogsChange = this._onSendLogsChange.bind(this);
3840
this._sendProgressCallback = this._sendProgressCallback.bind(this);
3941
}
@@ -47,28 +49,24 @@ export default class BugReportDialog extends React.Component {
4749
}
4850

4951
_onSubmit(ev) {
50-
const sendLogs = this.state.sendLogs;
51-
const userText = this.state.text;
52-
if (!sendLogs && userText.trim().length === 0) {
53-
this.setState({
54-
err: _t("Please describe the bug and/or send logs."),
55-
});
56-
return;
57-
}
52+
const userText =
53+
(this.state.text.length > 0 ? this.state.text + '\n\n': '') + 'Issue: ' +
54+
(this.state.issueUrl.length > 0 ? this.state.issueUrl : 'No issue link given');
55+
5856
this.setState({ busy: true, progress: null, err: null });
59-
this._sendProgressCallback(_t("Loading bug report module"));
57+
this._sendProgressCallback(_t("Preparing to send logs"));
6058

6159
require(['../../../vector/submit-rageshake'], (s) => {
6260
s(SdkConfig.get().bug_report_endpoint_url, {
63-
userText: userText,
64-
sendLogs: sendLogs,
61+
userText,
62+
sendLogs: true,
6563
progressCallback: this._sendProgressCallback,
6664
}).then(() => {
6765
if (!this._unmounted) {
6866
this.props.onFinished(false);
6967
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
7068
Modal.createTrackedDialog('Bug report sent', '', QuestionDialog, {
71-
title: _t('Bug report sent'),
69+
title: _t('Logs sent'),
7270
description: _t('Thank you!'),
7371
hasCancelButton: false,
7472
});
@@ -78,7 +76,7 @@ export default class BugReportDialog extends React.Component {
7876
this.setState({
7977
busy: false,
8078
progress: null,
81-
err: _t("Failed to send report: ") + `${err.message}`,
79+
err: _t("Failed to send logs: ") + `${err.message}`,
8280
});
8381
}
8482
});
@@ -89,7 +87,11 @@ export default class BugReportDialog extends React.Component {
8987
this.setState({ text: ev.target.value });
9088
}
9189

92-
_onSendLogsChange(ev) {
90+
_onIssueUrlChange(ev) {
91+
this.setState({ issueUrl: ev.target.value });
92+
}
93+
94+
_onSendLogsChange(ev) {
9395
this.setState({ sendLogs: ev.target.checked });
9496
}
9597

@@ -130,27 +132,61 @@ export default class BugReportDialog extends React.Component {
130132
return (
131133
<div className="mx_BugReportDialog">
132134
<div className="mx_Dialog_title">
133-
{ _t("Report a bug") }
135+
{ _t("Submit debug logs") }
134136
</div>
135137
<div className="mx_Dialog_content">
136138
<p>
137-
{ _t("Please describe the bug. What did you do? What did you expect to happen? What actually happened?") }
139+
{ _t(
140+
"Debug logs contain application usage data including your " +
141+
"username, the IDs or aliases of the rooms or groups you " +
142+
"have visited and the usernames of other users. They do " +
143+
"not contain messages.",
144+
) }
138145
</p>
139-
<textarea
140-
className="mx_BugReportDialog_input"
141-
rows={5}
142-
onChange={this._onTextChange}
143-
value={this.state.text}
144-
placeholder={_t("Describe your problem here.")}
145-
/>
146146
<p>
147-
{ _t("In order to diagnose problems, logs from this client will be sent with this bug report. If you would prefer to only send the text above, please untick:") }
147+
{ _t(
148+
"<a>Click here</a> to create a GitHub issue.",
149+
{},
150+
{
151+
a: (sub) => <a
152+
target="_blank"
153+
href="https://github.com/vector-im/riot-web/issues/new"
154+
>
155+
{ sub }
156+
</a>,
157+
},
158+
) }
148159
</p>
149-
<input type="checkbox" checked={this.state.sendLogs}
150-
onChange={this._onSendLogsChange} id="mx_BugReportDialog_logs"/>
151-
<label htmlFor="mx_BugReportDialog_logs">
152-
{ _t("Send logs") }
153-
</label>
160+
<div className="mx_BugReportDialog_field_container">
161+
<label
162+
htmlFor="mx_BugReportDialog_issueUrl"
163+
className="mx_BugReportDialog_field_label"
164+
>
165+
{ _t("GitHub issue link:") }
166+
</label>
167+
<input
168+
id="mx_BugReportDialog_issueUrl"
169+
type="text"
170+
className="mx_BugReportDialog_field_input"
171+
onChange={this._onIssueUrlChange}
172+
value={this.state.issueUrl}
173+
placeholder="https://github.com/vector-im/riot-web/issues/1337"
174+
/>
175+
</div>
176+
<div className="mx_BugReportDialog_field_container">
177+
<label
178+
htmlFor="mx_BugReportDialog_notes_label"
179+
className="mx_BugReportDialog_field_label"
180+
>
181+
{ _t("Notes:") }
182+
</label>
183+
<textarea
184+
className="mx_BugReportDialog_field_input"
185+
rows={5}
186+
onChange={this._onTextChange}
187+
value={this.state.text}
188+
/>
189+
</div>
154190
{progress}
155191
{error}
156192
</div>
@@ -161,7 +197,7 @@ export default class BugReportDialog extends React.Component {
161197
autoFocus={true}
162198
disabled={this.state.busy}
163199
>
164-
{ _t("Send") }
200+
{ _t("Send logs") }
165201
</button>
166202

167203
{cancelButton}

src/i18n/strings/en_EN.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,21 @@
7979
"Remove": "Remove",
8080
"Close": "Close",
8181
"Download this file": "Download this file",
82-
"Please describe the bug and/or send logs.": "Please describe the bug and/or send logs.",
83-
"Loading bug report module": "Loading bug report module",
84-
"Bug report sent": "Bug report sent",
82+
"Preparing to send logs": "Preparing to send logs",
83+
"Logs sent": "Logs sent",
8584
"Thank you!": "Thank you!",
86-
"Failed to send report: ": "Failed to send report: ",
85+
"Failed to send logs: ": "Failed to send logs: ",
8786
"Cancel": "Cancel",
88-
"Report a bug": "Report a bug",
89-
"Please describe the bug. What did you do? What did you expect to happen? What actually happened?": "Please describe the bug. What did you do? What did you expect to happen? What actually happened?",
90-
"Describe your problem here.": "Describe your problem here.",
91-
"In order to diagnose problems, logs from this client will be sent with this bug report. If you would prefer to only send the text above, please untick:": "In order to diagnose problems, logs from this client will be sent with this bug report. If you would prefer to only send the text above, please untick:",
87+
"Submit debug logs": "Submit debug logs",
88+
"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.": "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.",
89+
"<a>Click here</a> to create a GitHub issue.": "<a>Click here</a> to create a GitHub issue.",
90+
"GitHub issue link:": "GitHub issue link:",
91+
"Notes:": "Notes:",
9292
"Send logs": "Send logs",
93-
"Send": "Send",
9493
"Unavailable": "Unavailable",
9594
"Changelog": "Changelog",
9695
"Back": "Back",
96+
"Send": "Send",
9797
"Send Custom Event": "Send Custom Event",
9898
"You must specify an event type!": "You must specify an event type!",
9999
"Event sent!": "Event sent!",

src/skins/vector/css/matrix-react-sdk/views/dialogs/_BugReportDialog.scss

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,39 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
.mx_BugReportDialog_input {
18-
width: 100%;
19-
box-sizing: border-box;
17+
.mx_BugReportDialog_field_container {
18+
display: flex;
19+
}
20+
21+
.mx_BugReportDialog_field_label {
22+
flex-basis: 150px;
23+
24+
text-align: right;
25+
26+
padding-top: 9px;
27+
padding-right: 4px;
28+
29+
line-height: 18px;
30+
}
31+
32+
.mx_BugReportDialog_field_input {
33+
flex-grow: 1;
34+
35+
/* taken from mx_ChatInviteDialog_inputContainer */
36+
border-radius: 3px;
37+
border: solid 1px $input-border-color;
38+
39+
font-size: 14px;
40+
41+
padding-left: 4px;
42+
padding-right: 4px;
43+
padding-top: 7px;
44+
padding-bottom: 7px;
45+
46+
margin-bottom: 4px;
47+
}
48+
49+
.mx_BugReportDialog_field_input[type="text" i] {
50+
padding-top: 9px;
51+
padding-bottom: 9px;
2052
}

0 commit comments

Comments
 (0)