diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js index 62424cb1bc..badc994bb9 100644 --- a/src/components/views/dialogs/BugReportDialog.js +++ b/src/components/views/dialogs/BugReportDialog.js @@ -48,9 +48,10 @@ export default class BugReportDialog extends React.Component { return; } this.setState({ busy: true, err: null }); - submit_rageshake( - SdkConfig.get().bug_report_endpoint_url, userText, sendLogs, - ).then(() => { + submit_rageshake(SdkConfig.get().bug_report_endpoint_url, { + userText: userText, + sendLogs: sendLogs, + }).then(() => { this.setState({ busy: false }); this.props.onFinished(false); }, (err) => { diff --git a/src/vector/submit-rageshake.js b/src/vector/submit-rageshake.js index 871888211c..8c07007698 100644 --- a/src/vector/submit-rageshake.js +++ b/src/vector/submit-rageshake.js @@ -24,15 +24,18 @@ import rageshake from './rageshake' /** * Send a bug report. * @param {string} bugReportEndpoint HTTP url to send the report to - * @param {string} userText Any additional user input. - * @param {boolean} sendLogs True to send logs + * @param {object} opts optional dictionary of options + * @param {string} opts.userText Any additional user input. + * @param {boolean} opts.sendLogs True to send logs * @return {Promise} Resolved when the bug report is sent. */ -export default async function sendBugReport(bugReportEndpoint, userText, sendLogs) { +export default async function sendBugReport(bugReportEndpoint, opts) { if (!bugReportEndpoint) { throw new Error("No bug report endpoint has been set."); } + opts = opts || {}; + let version = "UNKNOWN"; try { version = await PlatformPeg.get().getAppVersion(); @@ -47,7 +50,7 @@ export default async function sendBugReport(bugReportEndpoint, userText, sendLog console.log("Sending bug report."); let logs = []; - if (sendLogs) { + if (opts.sendLogs) { logs = await rageshake.getLogsForReport(); } @@ -58,7 +61,7 @@ export default async function sendBugReport(bugReportEndpoint, userText, sendLog body: { logs: logs, text: ( - userText || "User did not supply any additional text." + opts.userText || "User did not supply any additional text." ), app: 'riot-web', version: version,