From cbfa4dd1abc6f8081db32ca3b1b4941d8c9c41b3 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 11 Apr 2017 18:46:48 +0100 Subject: [PATCH] Get rageshake endpoint from SdkConfig instead of storing in rageshake - in preparation for factoring out the sending of the rageshake --- src/components/views/dialogs/BugReportDialog.js | 5 ++++- src/vector/index.js | 1 - src/vector/rageshake.js | 8 ++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js index dcc0850ef7..c03c9b43ec 100644 --- a/src/components/views/dialogs/BugReportDialog.js +++ b/src/components/views/dialogs/BugReportDialog.js @@ -17,6 +17,7 @@ limitations under the License. import React from 'react'; import sdk from 'matrix-react-sdk'; import rageshake from '../../../vector/rageshake'; +import SdkConfig from 'matrix-react-sdk/lib/SdkConfig'; export default class BugReportDialog extends React.Component { constructor(props, context) { @@ -47,7 +48,9 @@ export default class BugReportDialog extends React.Component { return; } 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.props.onFinished(false); }, (err) => { diff --git a/src/vector/index.js b/src/vector/index.js index e08b717450..42a60e455c 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -259,7 +259,6 @@ async function loadApp() { let configError; try { configJson = await getConfig(); - rageshake.setBugReportEndpoint(configJson.bug_report_endpoint_url); } catch (e) { configError = e; } diff --git a/src/vector/rageshake.js b/src/vector/rageshake.js index 0e5b5dace2..c519f8b3ea 100644 --- a/src/vector/rageshake.js +++ b/src/vector/rageshake.js @@ -396,7 +396,6 @@ function selectQuery(store, keyRange, resultMapper) { let store = null; let logger = null; let initPromise = null; -let bugReportEndpoint = null; module.exports = { /** @@ -430,17 +429,14 @@ module.exports = { await store.consume(); }, - setBugReportEndpoint: function(url) { - bugReportEndpoint = url; - }, - /** * 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 * @return {Promise} Resolved when the bug report is sent. */ - sendBugReport: async function(userText, sendLogs) { + sendBugReport: async function(bugReportEndpoint, userText, sendLogs) { if (!logger) { throw new Error( "No console logger, did you forget to call init()?"