mirror of https://github.com/vector-im/riot-web
Get rageshake endpoint from SdkConfig instead of storing in rageshake
- in preparation for factoring out the sending of the rageshakepull/3645/head
parent
b26c460f13
commit
cbfa4dd1ab
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sdk from 'matrix-react-sdk';
|
import sdk from 'matrix-react-sdk';
|
||||||
import rageshake from '../../../vector/rageshake';
|
import rageshake from '../../../vector/rageshake';
|
||||||
|
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';
|
||||||
|
|
||||||
export default class BugReportDialog extends React.Component {
|
export default class BugReportDialog extends React.Component {
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
|
@ -47,7 +48,9 @@ export default class BugReportDialog extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({ busy: true, err: null });
|
this.setState({ busy: true, err: null });
|
||||||
rageshake.sendBugReport(userText, sendLogs).then(() => {
|
rageshake.sendBugReport(
|
||||||
|
SdkConfig.get().bug_report_endpoint_url, userText, sendLogs,
|
||||||
|
).then(() => {
|
||||||
this.setState({ busy: false });
|
this.setState({ busy: false });
|
||||||
this.props.onFinished(false);
|
this.props.onFinished(false);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
|
|
@ -259,7 +259,6 @@ async function loadApp() {
|
||||||
let configError;
|
let configError;
|
||||||
try {
|
try {
|
||||||
configJson = await getConfig();
|
configJson = await getConfig();
|
||||||
rageshake.setBugReportEndpoint(configJson.bug_report_endpoint_url);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
configError = e;
|
configError = e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,6 @@ function selectQuery(store, keyRange, resultMapper) {
|
||||||
let store = null;
|
let store = null;
|
||||||
let logger = null;
|
let logger = null;
|
||||||
let initPromise = null;
|
let initPromise = null;
|
||||||
let bugReportEndpoint = null;
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,17 +429,14 @@ module.exports = {
|
||||||
await store.consume();
|
await store.consume();
|
||||||
},
|
},
|
||||||
|
|
||||||
setBugReportEndpoint: function(url) {
|
|
||||||
bugReportEndpoint = url;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a bug report.
|
* Send a bug report.
|
||||||
|
* @param {string} bugReportEndpoint HTTP url to send the report to
|
||||||
* @param {string} userText Any additional user input.
|
* @param {string} userText Any additional user input.
|
||||||
* @param {boolean} sendLogs True to send logs
|
* @param {boolean} sendLogs True to send logs
|
||||||
* @return {Promise} Resolved when the bug report is sent.
|
* @return {Promise} Resolved when the bug report is sent.
|
||||||
*/
|
*/
|
||||||
sendBugReport: async function(userText, sendLogs) {
|
sendBugReport: async function(bugReportEndpoint, userText, sendLogs) {
|
||||||
if (!logger) {
|
if (!logger) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"No console logger, did you forget to call init()?"
|
"No console logger, did you forget to call init()?"
|
||||||
|
|
Loading…
Reference in New Issue