Filter settings exported when rageshaking (#30236)

* Submit filtered settings to rageshakes and sentry.

* Add flag to omit some settings from being exported.

* Hide user timezone

* Hide recent searches and media event ids

* Lint

* use better wording

* lint

* Prevent language from being sent

* Add tests to check keys are prevented from being uploaded.

* don't export invite rules

* Update tests
This commit is contained in:
Will Hunt
2025-07-02 09:03:31 +01:00
committed by GitHub
parent 99f7656d09
commit e1fea71c97
7 changed files with 107 additions and 34 deletions

View File

@@ -16,6 +16,7 @@ import BugReportDialog, {
} from "../../../../../src/components/views/dialogs/BugReportDialog";
import SdkConfig from "../../../../../src/SdkConfig";
import { type ConsoleLogger } from "../../../../../src/rageshake/rageshake";
import SettingsStore from "../../../../../src/settings/SettingsStore";
const BUG_REPORT_URL = "https://example.org/submit";
@@ -32,6 +33,16 @@ describe("BugReportDialog", () => {
bug_report_endpoint_url: BUG_REPORT_URL,
});
const originalGetValue = SettingsStore.getValue;
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName, ...args) => {
// These settings rely on a controller that creates an AudioContext in
// order to test whether the setting can be enabled. For the sake of this test, disable that.
if (settingName === "notificationsEnabled" || settingName === "notificationBodyEnabled") {
return true;
}
return originalGetValue(settingName, ...args);
});
const mockConsoleLogger = {
flush: jest.fn(),
consume: jest.fn(),
@@ -55,6 +66,7 @@ describe("BugReportDialog", () => {
});
afterEach(() => {
jest.restoreAllMocks();
SdkConfig.reset();
fetchMock.restore();
});