Remove hidden read receipts migration (#11139)

* Remove hidden read receipts migration

* remove unused values

* Remove hidden RR migration test
This commit is contained in:
Germain 2023-07-07 11:55:16 +01:00 committed by GitHub
parent 71fe08ea0f
commit 252f2ebec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 123 deletions

View file

@ -35,9 +35,6 @@ import SettingsHandler from "./handlers/SettingsHandler";
import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload";
import { Action } from "../dispatcher/actions";
import PlatformSettingsHandler from "./handlers/PlatformSettingsHandler";
import dispatcher from "../dispatcher/dispatcher";
import { ActionPayload } from "../dispatcher/payloads";
import { MatrixClientPeg } from "../MatrixClientPeg";
// Convert the settings to easier to manage objects for the handlers
const defaultSettings: Record<string, any> = {};
@ -606,36 +603,7 @@ export default class SettingsStore {
public static runMigrations(): void {
// Dev notes: to add your migration, just add a new `migrateMyFeature` function, call it, and
// add a comment to note when it can be removed.
SettingsStore.migrateHiddenReadReceipts(); // Can be removed after October 2022.
}
private static migrateHiddenReadReceipts(): void {
if (MatrixClientPeg.safeGet().isGuest()) return; // not worth it
// We wait for the first sync to ensure that the user's existing account data has loaded, as otherwise
// getValue() for an account-level setting like sendReadReceipts will return `null`.
const disRef = dispatcher.register((payload: ActionPayload) => {
if (payload.action === "MatrixActions.sync") {
dispatcher.unregister(disRef);
const rrVal = SettingsStore.getValue("sendReadReceipts", null, true);
if (typeof rrVal !== "boolean") {
// new setting isn't set - see if the labs flag was. We have to manually reach into the
// handler for this because it isn't a setting anymore (`getValue` will yell at us).
const handler = LEVEL_HANDLERS[SettingLevel.DEVICE] as DeviceSettingsHandler;
const labsVal = handler.readFeature("feature_hidden_read_receipts");
if (typeof labsVal === "boolean") {
// Inverse of labs flag because negative->positive language switch in setting name
const newVal = !labsVal;
console.log(`Setting sendReadReceipts to ${newVal} because of previously-set labs flag`);
// noinspection JSIgnoredPromiseFromCall
SettingsStore.setValue("sendReadReceipts", null, SettingLevel.ACCOUNT, newVal);
}
}
}
});
return;
}
/**