Skip to content

Commit 3f291aa

Browse files
committed
Use an opts arg for submit-rageshake
1 parent 6423f7c commit 3f291aa

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎src/components/views/dialogs/BugReportDialog.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ export default class BugReportDialog extends React.Component {
4848
return;
4949
}
5050
this.setState({ busy: true, err: null });
51-
submit_rageshake(
52-
SdkConfig.get().bug_report_endpoint_url, userText, sendLogs,
53-
).then(() => {
51+
submit_rageshake(SdkConfig.get().bug_report_endpoint_url, {
52+
userText: userText,
53+
sendLogs: sendLogs,
54+
}).then(() => {
5455
this.setState({ busy: false });
5556
this.props.onFinished(false);
5657
}, (err) => {

‎src/vector/submit-rageshake.js‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ import rageshake from './rageshake'
2424
/**
2525
* Send a bug report.
2626
* @param {string} bugReportEndpoint HTTP url to send the report to
27-
* @param {string} userText Any additional user input.
28-
* @param {boolean} sendLogs True to send logs
27+
* @param {object} opts optional dictionary of options
28+
* @param {string} opts.userText Any additional user input.
29+
* @param {boolean} opts.sendLogs True to send logs
2930
* @return {Promise} Resolved when the bug report is sent.
3031
*/
31-
export default async function sendBugReport(bugReportEndpoint, userText, sendLogs) {
32+
export default async function sendBugReport(bugReportEndpoint, opts) {
3233
if (!bugReportEndpoint) {
3334
throw new Error("No bug report endpoint has been set.");
3435
}
3536

37+
opts = opts || {};
38+
3639
let version = "UNKNOWN";
3740
try {
3841
version = await PlatformPeg.get().getAppVersion();
@@ -47,7 +50,7 @@ export default async function sendBugReport(bugReportEndpoint, userText, sendLog
4750
console.log("Sending bug report.");
4851

4952
let logs = [];
50-
if (sendLogs) {
53+
if (opts.sendLogs) {
5154
logs = await rageshake.getLogsForReport();
5255
}
5356

@@ -58,7 +61,7 @@ export default async function sendBugReport(bugReportEndpoint, userText, sendLog
5861
body: {
5962
logs: logs,
6063
text: (
61-
userText || "User did not supply any additional text."
64+
opts.userText || "User did not supply any additional text."
6265
),
6366
app: 'riot-web',
6467
version: version,

0 commit comments

Comments
 (0)