From 710e295b44c78d72bc96011fe91f72148e0e9868 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 27 Nov 2018 16:03:37 -0700 Subject: [PATCH 1/3] Add a function to send a rageshake from the console This is mostly useful for cases when the UI is broken or the user can't access the button because they aren't logged in. This is particularly helpful for troubleshooting issues with .well-known discovery if/when they come up. Ref: https://github.com/vector-im/riot-web/issues/4802 --- src/vector/rageshakesetup.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vector/rageshakesetup.js b/src/vector/rageshakesetup.js index b240e159170..e2449406735 100644 --- a/src/vector/rageshakesetup.js +++ b/src/vector/rageshakesetup.js @@ -26,6 +26,7 @@ limitations under the License. */ import rageshake from "matrix-react-sdk/lib/rageshake/rageshake"; +import SdkConfig from "matrix-react-sdk/src/SdkConfig"; function initRageshake() { rageshake.init().then(() => { @@ -44,3 +45,17 @@ function initRageshake() { } initRageshake(); + +global.mxSendRageshake = function(text, withLogs) { + require(['matrix-react-sdk/lib/rageshake/submit-rageshake'], (s) => { + s(SdkConfig.get().bug_report_endpoint_url, { + userText: text, + sendLogs: withLogs, + progressCallback: console.log, + }).then(() => { + console.log("Bug report sent!"); + }, (err) => { + console.error(err); + }); + }); +}; \ No newline at end of file From ac34ca11df68a3a44615d247aede3f0c796eb308 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 27 Nov 2018 16:11:58 -0700 Subject: [PATCH 2/3] Appease the linter --- src/vector/rageshakesetup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/rageshakesetup.js b/src/vector/rageshakesetup.js index e2449406735..64e6bce0f8c 100644 --- a/src/vector/rageshakesetup.js +++ b/src/vector/rageshakesetup.js @@ -58,4 +58,4 @@ global.mxSendRageshake = function(text, withLogs) { console.error(err); }); }); -}; \ No newline at end of file +}; From 373f850002a658115d3676438955391dcf28fee5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 29 Nov 2018 13:13:46 -0700 Subject: [PATCH 3/3] Safely bind console.log and default withLogs to true --- src/vector/rageshakesetup.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vector/rageshakesetup.js b/src/vector/rageshakesetup.js index 64e6bce0f8c..2ea438ef5b9 100644 --- a/src/vector/rageshakesetup.js +++ b/src/vector/rageshakesetup.js @@ -47,11 +47,12 @@ function initRageshake() { initRageshake(); global.mxSendRageshake = function(text, withLogs) { + if (withLogs === undefined) withLogs = true; require(['matrix-react-sdk/lib/rageshake/submit-rageshake'], (s) => { s(SdkConfig.get().bug_report_endpoint_url, { userText: text, sendLogs: withLogs, - progressCallback: console.log, + progressCallback: console.log.bind(console), }).then(() => { console.log("Bug report sent!"); }, (err) => {