Use an opts arg for submit-rageshake
This commit is contained in:
parent
6423f7ce03
commit
3f291aae5b
|
@ -48,9 +48,10 @@ export default class BugReportDialog extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({ busy: true, err: null });
|
this.setState({ busy: true, err: null });
|
||||||
submit_rageshake(
|
submit_rageshake(SdkConfig.get().bug_report_endpoint_url, {
|
||||||
SdkConfig.get().bug_report_endpoint_url, userText, sendLogs,
|
userText: userText,
|
||||||
).then(() => {
|
sendLogs: sendLogs,
|
||||||
|
}).then(() => {
|
||||||
this.setState({ busy: false });
|
this.setState({ busy: false });
|
||||||
this.props.onFinished(false);
|
this.props.onFinished(false);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
|
|
@ -24,15 +24,18 @@ import rageshake from './rageshake'
|
||||||
/**
|
/**
|
||||||
* Send a bug report.
|
* Send a bug report.
|
||||||
* @param {string} bugReportEndpoint HTTP url to send the report to
|
* @param {string} bugReportEndpoint HTTP url to send the report to
|
||||||
* @param {string} userText Any additional user input.
|
* @param {object} opts optional dictionary of options
|
||||||
* @param {boolean} sendLogs True to send logs
|
* @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.
|
* @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) {
|
if (!bugReportEndpoint) {
|
||||||
throw new Error("No bug report endpoint has been set.");
|
throw new Error("No bug report endpoint has been set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
let version = "UNKNOWN";
|
let version = "UNKNOWN";
|
||||||
try {
|
try {
|
||||||
version = await PlatformPeg.get().getAppVersion();
|
version = await PlatformPeg.get().getAppVersion();
|
||||||
|
@ -47,7 +50,7 @@ export default async function sendBugReport(bugReportEndpoint, userText, sendLog
|
||||||
console.log("Sending bug report.");
|
console.log("Sending bug report.");
|
||||||
|
|
||||||
let logs = [];
|
let logs = [];
|
||||||
if (sendLogs) {
|
if (opts.sendLogs) {
|
||||||
logs = await rageshake.getLogsForReport();
|
logs = await rageshake.getLogsForReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +61,7 @@ export default async function sendBugReport(bugReportEndpoint, userText, sendLog
|
||||||
body: {
|
body: {
|
||||||
logs: logs,
|
logs: logs,
|
||||||
text: (
|
text: (
|
||||||
userText || "User did not supply any additional text."
|
opts.userText || "User did not supply any additional text."
|
||||||
),
|
),
|
||||||
app: 'riot-web',
|
app: 'riot-web',
|
||||||
version: version,
|
version: version,
|
||||||
|
|
Loading…
Reference in New Issue