mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-10 01:01:45 +00:00
Remove unused function to auto-rageshake when key backup is not set up (#31942)
This commit is contained in:
@@ -493,8 +493,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
|
|||||||
if (allSystemsReady) {
|
if (allSystemsReady) {
|
||||||
logSpan.info("No toast needed");
|
logSpan.info("No toast needed");
|
||||||
await this.setDeviceState("ok", logSpan);
|
await this.setDeviceState("ok", logSpan);
|
||||||
|
|
||||||
this.checkKeyBackupStatus();
|
|
||||||
} else {
|
} else {
|
||||||
// make sure our keys are finished downloading
|
// make sure our keys are finished downloading
|
||||||
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);
|
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);
|
||||||
@@ -549,9 +547,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
|
|||||||
});
|
});
|
||||||
await this.setDeviceState("key_storage_out_of_sync", logSpan);
|
await this.setDeviceState("key_storage_out_of_sync", logSpan);
|
||||||
}
|
}
|
||||||
if (this.dismissedThisDeviceToast) {
|
|
||||||
this.checkKeyBackupStatus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This needs to be done after awaiting on getUserDeviceInfo() above, so
|
// This needs to be done after awaiting on getUserDeviceInfo() above, so
|
||||||
@@ -733,16 +728,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if key backup is enabled, and if not, raise an `Action.ReportKeyBackupNotEnabled` event (which will
|
|
||||||
* trigger an auto-rageshake).
|
|
||||||
*/
|
|
||||||
private checkKeyBackupStatus = async (): Promise<void> => {
|
|
||||||
if (!(await this.isKeyBackupUploadActive(logger))) {
|
|
||||||
dis.dispatch({ action: Action.ReportKeyBackupNotEnabled });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is key backup enabled? Use a cached answer if we have one.
|
* Is key backup enabled? Use a cached answer if we have one.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -229,12 +229,6 @@ export enum Action {
|
|||||||
*/
|
*/
|
||||||
PseudonymousAnalyticsReject = "pseudonymous_analytics_reject",
|
PseudonymousAnalyticsReject = "pseudonymous_analytics_reject",
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires after crypto is setup if key backup is not enabled
|
|
||||||
* Used to trigger auto rageshakes when configured
|
|
||||||
*/
|
|
||||||
ReportKeyBackupNotEnabled = "report_key_backup_not_enabled",
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatched after leave room or space is finished
|
* Dispatched after leave room or space is finished
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1508,7 +1508,6 @@
|
|||||||
"ask_to_join": "Enable ask to join",
|
"ask_to_join": "Enable ask to join",
|
||||||
"automatic_debug_logs": "Automatically send debug logs on any error",
|
"automatic_debug_logs": "Automatically send debug logs on any error",
|
||||||
"automatic_debug_logs_decryption": "Automatically send debug logs on decryption errors",
|
"automatic_debug_logs_decryption": "Automatically send debug logs on decryption errors",
|
||||||
"automatic_debug_logs_key_backup": "Automatically send debug logs when key backup is not functioning",
|
|
||||||
"beta_description": "What's next for %(brand)s? Labs are the best way to get things early, test out new features and help shape them before they actually launch.",
|
"beta_description": "What's next for %(brand)s? Labs are the best way to get things early, test out new features and help shape them before they actually launch.",
|
||||||
"beta_feature": "This is a beta feature",
|
"beta_feature": "This is a beta feature",
|
||||||
"beta_feedback_leave_button": "To leave the beta, visit your settings.",
|
"beta_feedback_leave_button": "To leave the beta, visit your settings.",
|
||||||
|
|||||||
@@ -352,7 +352,6 @@ export interface Settings {
|
|||||||
"developerMode": IBaseSetting<boolean>;
|
"developerMode": IBaseSetting<boolean>;
|
||||||
"automaticErrorReporting": IBaseSetting<boolean>;
|
"automaticErrorReporting": IBaseSetting<boolean>;
|
||||||
"automaticDecryptionErrorReporting": IBaseSetting<boolean>;
|
"automaticDecryptionErrorReporting": IBaseSetting<boolean>;
|
||||||
"automaticKeyBackNotEnabledReporting": IBaseSetting<boolean>;
|
|
||||||
"debug_scroll_panel": IBaseSetting<boolean>;
|
"debug_scroll_panel": IBaseSetting<boolean>;
|
||||||
"debug_timeline_panel": IBaseSetting<boolean>;
|
"debug_timeline_panel": IBaseSetting<boolean>;
|
||||||
"debug_registration": IBaseSetting<boolean>;
|
"debug_registration": IBaseSetting<boolean>;
|
||||||
@@ -1320,11 +1319,6 @@ export const SETTINGS: Settings = {
|
|||||||
default: false,
|
default: false,
|
||||||
controller: new ReloadOnChangeController(),
|
controller: new ReloadOnChangeController(),
|
||||||
},
|
},
|
||||||
"automaticKeyBackNotEnabledReporting": {
|
|
||||||
displayName: _td("labs|automatic_debug_logs_key_backup"),
|
|
||||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
"debug_scroll_panel": {
|
"debug_scroll_panel": {
|
||||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||||
default: false,
|
default: false,
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import defaultDispatcher from "../dispatcher/dispatcher";
|
|||||||
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
|
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
|
||||||
import { type ActionPayload } from "../dispatcher/payloads";
|
import { type ActionPayload } from "../dispatcher/payloads";
|
||||||
import SettingsStore from "../settings/SettingsStore";
|
import SettingsStore from "../settings/SettingsStore";
|
||||||
import { Action } from "../dispatcher/actions";
|
|
||||||
|
|
||||||
// Minimum interval of 1 minute between reports
|
// Minimum interval of 1 minute between reports
|
||||||
const RAGESHAKE_INTERVAL = 60000;
|
const RAGESHAKE_INTERVAL = 60000;
|
||||||
@@ -66,12 +65,7 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient<IState> {
|
|||||||
return AutoRageshakeStore.internalInstance;
|
return AutoRageshakeStore.internalInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async onAction(payload: ActionPayload): Promise<void> {
|
protected async onAction(_payload: ActionPayload): Promise<void> {}
|
||||||
switch (payload.action) {
|
|
||||||
case Action.ReportKeyBackupNotEnabled:
|
|
||||||
this.onReportKeyBackupNotEnabled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async onReady(): Promise<void> {
|
protected async onReady(): Promise<void> {
|
||||||
if (!SettingsStore.getValue("automaticDecryptionErrorReporting")) return;
|
if (!SettingsStore.getValue("automaticDecryptionErrorReporting")) return;
|
||||||
@@ -187,16 +181,6 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient<IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onReportKeyBackupNotEnabled(): Promise<void> {
|
|
||||||
if (!SettingsStore.getValue("automaticKeyBackNotEnabledReporting")) return;
|
|
||||||
|
|
||||||
await sendBugReport(SdkConfig.get().bug_report_endpoint_url, {
|
|
||||||
userText: `Auto-reporting key backup not enabled`,
|
|
||||||
sendLogs: true,
|
|
||||||
labels: ["web", Action.ReportKeyBackupNotEnabled],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.mxAutoRageshakeStore = AutoRageshakeStore.instance;
|
window.mxAutoRageshakeStore = AutoRageshakeStore.instance;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import * as SetupEncryptionToast from "../../src/toasts/SetupEncryptionToast";
|
|||||||
import * as UnverifiedSessionToast from "../../src/toasts/UnverifiedSessionToast";
|
import * as UnverifiedSessionToast from "../../src/toasts/UnverifiedSessionToast";
|
||||||
import * as BulkUnverifiedSessionsToast from "../../src/toasts/BulkUnverifiedSessionsToast";
|
import * as BulkUnverifiedSessionsToast from "../../src/toasts/BulkUnverifiedSessionsToast";
|
||||||
import { isSecretStorageBeingAccessed } from "../../src/SecurityManager";
|
import { isSecretStorageBeingAccessed } from "../../src/SecurityManager";
|
||||||
import dis from "../../src/dispatcher/dispatcher";
|
|
||||||
import { Action } from "../../src/dispatcher/actions";
|
import { Action } from "../../src/dispatcher/actions";
|
||||||
import SettingsStore from "../../src/settings/SettingsStore";
|
import SettingsStore from "../../src/settings/SettingsStore";
|
||||||
import { SettingLevel } from "../../src/settings/SettingLevel";
|
import { SettingLevel } from "../../src/settings/SettingLevel";
|
||||||
@@ -57,7 +56,6 @@ jest.mock("../../src/utils/device/snoozeBulkUnverifiedDeviceReminder", () => ({
|
|||||||
|
|
||||||
const userId = "@user:server";
|
const userId = "@user:server";
|
||||||
const deviceId = "my-device-id";
|
const deviceId = "my-device-id";
|
||||||
const mockDispatcher = mocked(dis);
|
|
||||||
const flushPromises = async () => await new Promise(process.nextTick);
|
const flushPromises = async () => await new Promise(process.nextTick);
|
||||||
|
|
||||||
const readySecretStorageStatus: SecretStorageStatus = {
|
const readySecretStorageStatus: SecretStorageStatus = {
|
||||||
@@ -498,27 +496,6 @@ describe("DeviceListener", () => {
|
|||||||
expect(mockCrypto.getActiveSessionBackupVersion).toHaveBeenCalled();
|
expect(mockCrypto.getActiveSessionBackupVersion).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("dispatches keybackup event when key backup is not enabled", async () => {
|
|
||||||
mockCrypto!.isCrossSigningReady.mockResolvedValue(true);
|
|
||||||
|
|
||||||
// current device is verified
|
|
||||||
mockCrypto!.getDeviceVerificationStatus.mockResolvedValue(
|
|
||||||
new DeviceVerificationStatus({
|
|
||||||
trustCrossSignedDevices: true,
|
|
||||||
crossSigningVerified: true,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
mockCrypto.getActiveSessionBackupVersion.mockResolvedValue(null);
|
|
||||||
mockClient.getAccountDataFromServer.mockImplementation((eventType) =>
|
|
||||||
eventType === BACKUP_DISABLED_ACCOUNT_DATA_KEY ? ({ disabled: true } as any) : null,
|
|
||||||
);
|
|
||||||
await createAndStart();
|
|
||||||
expect(mockDispatcher.dispatch).toHaveBeenCalledWith({
|
|
||||||
action: Action.ReportKeyBackupNotEnabled,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("does not check key backup status again after check is complete", async () => {
|
it("does not check key backup status again after check is complete", async () => {
|
||||||
mockCrypto.getActiveSessionBackupVersion.mockResolvedValue("1");
|
mockCrypto.getActiveSessionBackupVersion.mockResolvedValue("1");
|
||||||
const instance = await createAndStart();
|
const instance = await createAndStart();
|
||||||
|
|||||||
Reference in New Issue
Block a user