Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to send a rageshake from the console #7755

Merged
merged 3 commits into from
Nov 29, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/vector/rageshakesetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -44,3 +45,17 @@ function initRageshake() {
}

initRageshake();

global.mxSendRageshake = function(text, withLogs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to default withLogs to true if it isn't specified? There is a bit of a privacy concern that people might be sending logs without realizing it, but it seems to me like the main use case for this function is to send logs. I'd be fine either way.

require(['matrix-react-sdk/lib/rageshake/submit-rageshake'], (s) => {
s(SdkConfig.get().bug_report_endpoint_url, {
userText: text,
sendLogs: withLogs,
progressCallback: console.log,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using just console.log as a callback breaks in one of the browsers (I forget which one) because it expects console.log to be called as a method on the console object, rather than just a function. It can be fixed by using console.log.bind(console) a the callback instead.

}).then(() => {
console.log("Bug report sent!");
}, (err) => {
console.error(err);
});
});
};