Use an opts arg for submit-rageshake

pull/3645/head
Richard van der Hoff 2017-04-12 11:26:53 +01:00
parent 6423f7ce03
commit 3f291aae5b
2 changed files with 12 additions and 8 deletions

View File

@ -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) => {

View File

@ -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,