Merge pull request #16697 from vector-im/travis/no-persist-logs
Disable rageshake persistence if no logs would be submitted
This commit is contained in:
commit
025225a899
3 changed files with 24 additions and 2 deletions
|
@ -92,6 +92,7 @@ async function start() {
|
||||||
// load init.ts async so that its code is not executed immediately and we can catch any exceptions
|
// load init.ts async so that its code is not executed immediately and we can catch any exceptions
|
||||||
const {
|
const {
|
||||||
rageshakePromise,
|
rageshakePromise,
|
||||||
|
setupLogStorage,
|
||||||
preparePlatform,
|
preparePlatform,
|
||||||
loadOlm,
|
loadOlm,
|
||||||
loadConfig,
|
loadConfig,
|
||||||
|
@ -138,6 +139,9 @@ async function start() {
|
||||||
await settled(loadConfigPromise); // wait for it to settle
|
await settled(loadConfigPromise); // wait for it to settle
|
||||||
// keep initialising so that we can show any possible error with as many features (theme, i18n) as possible
|
// keep initialising so that we can show any possible error with as many features (theme, i18n) as possible
|
||||||
|
|
||||||
|
// now that the config is ready, try to persist logs
|
||||||
|
const persistLogsPromise = setupLogStorage();
|
||||||
|
|
||||||
// Load language after loading config.json so that settingsDefaults.language can be applied
|
// Load language after loading config.json so that settingsDefaults.language can be applied
|
||||||
const loadLanguagePromise = loadLanguage();
|
const loadLanguagePromise = loadLanguage();
|
||||||
// as quickly as we possibly can, set a default theme...
|
// as quickly as we possibly can, set a default theme...
|
||||||
|
@ -197,6 +201,11 @@ async function start() {
|
||||||
await loadThemePromise;
|
await loadThemePromise;
|
||||||
await loadLanguagePromise;
|
await loadLanguagePromise;
|
||||||
|
|
||||||
|
// We don't care if the log persistence made it through successfully, but we do want to
|
||||||
|
// make sure it had a chance to load before we move on. It's prepared much higher up in
|
||||||
|
// the process, making this the first time we check that it did something.
|
||||||
|
await settled(persistLogsPromise);
|
||||||
|
|
||||||
// Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
|
// Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
|
||||||
// run on the components.
|
// run on the components.
|
||||||
await loadApp(fragparts.params);
|
await loadApp(fragparts.params);
|
||||||
|
|
|
@ -33,7 +33,7 @@ import PlatformPeg from "matrix-react-sdk/src/PlatformPeg";
|
||||||
import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
||||||
import {setTheme} from "matrix-react-sdk/src/theme";
|
import {setTheme} from "matrix-react-sdk/src/theme";
|
||||||
|
|
||||||
import { initRageshake } from "./rageshakesetup";
|
import {initRageshake, initRageshakeStore} from "./rageshakesetup";
|
||||||
|
|
||||||
|
|
||||||
export const rageshakePromise = initRageshake();
|
export const rageshakePromise = initRageshake();
|
||||||
|
@ -51,6 +51,14 @@ export function preparePlatform() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setupLogStorage() {
|
||||||
|
if (SdkConfig.get().bug_report_endpoint_url) {
|
||||||
|
return initRageshakeStore();
|
||||||
|
}
|
||||||
|
console.warn("No bug report endpoint set - logs will not be persisted");
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
export async function loadConfig() {
|
export async function loadConfig() {
|
||||||
// XXX: We call this twice, once here and once in MatrixChat as a prop. We call it here to ensure
|
// XXX: We call this twice, once here and once in MatrixChat as a prop. We call it here to ensure
|
||||||
// granular settings are loaded correctly and to avoid duplicating the override logic for the theme.
|
// granular settings are loaded correctly and to avoid duplicating the override logic for the theme.
|
||||||
|
|
|
@ -31,7 +31,8 @@ import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
||||||
import sendBugReport from "matrix-react-sdk/src/rageshake/submit-rageshake";
|
import sendBugReport from "matrix-react-sdk/src/rageshake/submit-rageshake";
|
||||||
|
|
||||||
export function initRageshake() {
|
export function initRageshake() {
|
||||||
const prom = rageshake.init();
|
// we manually check persistence for rageshakes ourselves
|
||||||
|
const prom = rageshake.init(/*setUpPersistence=*/false);
|
||||||
prom.then(() => {
|
prom.then(() => {
|
||||||
console.log("Initialised rageshake.");
|
console.log("Initialised rageshake.");
|
||||||
console.log("To fix line numbers in Chrome: " +
|
console.log("To fix line numbers in Chrome: " +
|
||||||
|
@ -50,6 +51,10 @@ export function initRageshake() {
|
||||||
return prom;
|
return prom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function initRageshakeStore() {
|
||||||
|
return rageshake.tryInitStorage();
|
||||||
|
}
|
||||||
|
|
||||||
window.mxSendRageshake = function(text: string, withLogs?: boolean) {
|
window.mxSendRageshake = function(text: string, withLogs?: boolean) {
|
||||||
const url = SdkConfig.get().bug_report_endpoint_url;
|
const url = SdkConfig.get().bug_report_endpoint_url;
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
|
Loading…
Reference in a new issue