Skip to content

Commit eb909f1

Browse files
authored
Remove unused function to auto-rageshake when key backup is not set up (#31942)
1 parent af55def commit eb909f1

File tree

6 files changed

+1
-68
lines changed

6 files changed

+1
-68
lines changed

src/DeviceListener.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
493493
if (allSystemsReady) {
494494
logSpan.info("No toast needed");
495495
await this.setDeviceState("ok", logSpan);
496-
497-
this.checkKeyBackupStatus();
498496
} else {
499497
// make sure our keys are finished downloading
500498
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);
@@ -549,9 +547,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
549547
});
550548
await this.setDeviceState("key_storage_out_of_sync", logSpan);
551549
}
552-
if (this.dismissedThisDeviceToast) {
553-
this.checkKeyBackupStatus();
554-
}
555550
}
556551

557552
// This needs to be done after awaiting on getUserDeviceInfo() above, so
@@ -733,16 +728,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
733728
});
734729
}
735730

736-
/**
737-
* Check if key backup is enabled, and if not, raise an `Action.ReportKeyBackupNotEnabled` event (which will
738-
* trigger an auto-rageshake).
739-
*/
740-
private checkKeyBackupStatus = async (): Promise<void> => {
741-
if (!(await this.isKeyBackupUploadActive(logger))) {
742-
dis.dispatch({ action: Action.ReportKeyBackupNotEnabled });
743-
}
744-
};
745-
746731
/**
747732
* Is key backup enabled? Use a cached answer if we have one.
748733
*/

src/dispatcher/actions.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,6 @@ export enum Action {
229229
*/
230230
PseudonymousAnalyticsReject = "pseudonymous_analytics_reject",
231231

232-
/**
233-
* Fires after crypto is setup if key backup is not enabled
234-
* Used to trigger auto rageshakes when configured
235-
*/
236-
ReportKeyBackupNotEnabled = "report_key_backup_not_enabled",
237-
238232
/**
239233
* Dispatched after leave room or space is finished
240234
*/

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,6 @@
15081508
"ask_to_join": "Enable ask to join",
15091509
"automatic_debug_logs": "Automatically send debug logs on any error",
15101510
"automatic_debug_logs_decryption": "Automatically send debug logs on decryption errors",
1511-
"automatic_debug_logs_key_backup": "Automatically send debug logs when key backup is not functioning",
15121511
"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.",
15131512
"beta_feature": "This is a beta feature",
15141513
"beta_feedback_leave_button": "To leave the beta, visit your settings.",

src/settings/Settings.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ export interface Settings {
352352
"developerMode": IBaseSetting<boolean>;
353353
"automaticErrorReporting": IBaseSetting<boolean>;
354354
"automaticDecryptionErrorReporting": IBaseSetting<boolean>;
355-
"automaticKeyBackNotEnabledReporting": IBaseSetting<boolean>;
356355
"debug_scroll_panel": IBaseSetting<boolean>;
357356
"debug_timeline_panel": IBaseSetting<boolean>;
358357
"debug_registration": IBaseSetting<boolean>;
@@ -1320,11 +1319,6 @@ export const SETTINGS: Settings = {
13201319
default: false,
13211320
controller: new ReloadOnChangeController(),
13221321
},
1323-
"automaticKeyBackNotEnabledReporting": {
1324-
displayName: _td("labs|automatic_debug_logs_key_backup"),
1325-
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
1326-
default: false,
1327-
},
13281322
"debug_scroll_panel": {
13291323
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
13301324
default: false,

src/stores/AutoRageshakeStore.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import defaultDispatcher from "../dispatcher/dispatcher";
2424
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
2525
import { type ActionPayload } from "../dispatcher/payloads";
2626
import SettingsStore from "../settings/SettingsStore";
27-
import { Action } from "../dispatcher/actions";
2827

2928
// Minimum interval of 1 minute between reports
3029
const RAGESHAKE_INTERVAL = 60000;
@@ -66,12 +65,7 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient<IState> {
6665
return AutoRageshakeStore.internalInstance;
6766
}
6867

69-
protected async onAction(payload: ActionPayload): Promise<void> {
70-
switch (payload.action) {
71-
case Action.ReportKeyBackupNotEnabled:
72-
this.onReportKeyBackupNotEnabled();
73-
}
74-
}
68+
protected async onAction(_payload: ActionPayload): Promise<void> {}
7569

7670
protected async onReady(): Promise<void> {
7771
if (!SettingsStore.getValue("automaticDecryptionErrorReporting")) return;
@@ -187,16 +181,6 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient<IState> {
187181
);
188182
}
189183
}
190-
191-
private async onReportKeyBackupNotEnabled(): Promise<void> {
192-
if (!SettingsStore.getValue("automaticKeyBackNotEnabledReporting")) return;
193-
194-
await sendBugReport(SdkConfig.get().bug_report_endpoint_url, {
195-
userText: `Auto-reporting key backup not enabled`,
196-
sendLogs: true,
197-
labels: ["web", Action.ReportKeyBackupNotEnabled],
198-
});
199-
}
200184
}
201185

202186
window.mxAutoRageshakeStore = AutoRageshakeStore.instance;

test/unit-tests/DeviceListener-test.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import * as SetupEncryptionToast from "../../src/toasts/SetupEncryptionToast";
3131
import * as UnverifiedSessionToast from "../../src/toasts/UnverifiedSessionToast";
3232
import * as BulkUnverifiedSessionsToast from "../../src/toasts/BulkUnverifiedSessionsToast";
3333
import { isSecretStorageBeingAccessed } from "../../src/SecurityManager";
34-
import dis from "../../src/dispatcher/dispatcher";
3534
import { Action } from "../../src/dispatcher/actions";
3635
import SettingsStore from "../../src/settings/SettingsStore";
3736
import { SettingLevel } from "../../src/settings/SettingLevel";
@@ -57,7 +56,6 @@ jest.mock("../../src/utils/device/snoozeBulkUnverifiedDeviceReminder", () => ({
5756

5857
const userId = "@user:server";
5958
const deviceId = "my-device-id";
60-
const mockDispatcher = mocked(dis);
6159
const flushPromises = async () => await new Promise(process.nextTick);
6260

6361
const readySecretStorageStatus: SecretStorageStatus = {
@@ -498,27 +496,6 @@ describe("DeviceListener", () => {
498496
expect(mockCrypto.getActiveSessionBackupVersion).toHaveBeenCalled();
499497
});
500498

501-
it("dispatches keybackup event when key backup is not enabled", async () => {
502-
mockCrypto!.isCrossSigningReady.mockResolvedValue(true);
503-
504-
// current device is verified
505-
mockCrypto!.getDeviceVerificationStatus.mockResolvedValue(
506-
new DeviceVerificationStatus({
507-
trustCrossSignedDevices: true,
508-
crossSigningVerified: true,
509-
}),
510-
);
511-
512-
mockCrypto.getActiveSessionBackupVersion.mockResolvedValue(null);
513-
mockClient.getAccountDataFromServer.mockImplementation((eventType) =>
514-
eventType === BACKUP_DISABLED_ACCOUNT_DATA_KEY ? ({ disabled: true } as any) : null,
515-
);
516-
await createAndStart();
517-
expect(mockDispatcher.dispatch).toHaveBeenCalledWith({
518-
action: Action.ReportKeyBackupNotEnabled,
519-
});
520-
});
521-
522499
it("does not check key backup status again after check is complete", async () => {
523500
mockCrypto.getActiveSessionBackupVersion.mockResolvedValue("1");
524501
const instance = await createAndStart();

0 commit comments

Comments
 (0)