mirror of https://github.com/vector-im/riot-web
Use an opts arg for submit-rageshake
parent
6423f7ce03
commit
3f291aae5b
|
@ -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) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue