Handle migration from useIRCLayout to layout
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
972c947049
commit
7efbd50e31
|
@ -20,6 +20,7 @@ import SettingsHandler from "./SettingsHandler";
|
|||
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
||||
import {SettingLevel} from "../SettingLevel";
|
||||
import { CallbackFn, WatchManager } from "../WatchManager";
|
||||
import { Layout } from "../Layout";
|
||||
|
||||
/**
|
||||
* Gets and sets settings at the "device" level for the current device.
|
||||
|
@ -67,6 +68,13 @@ export default class DeviceSettingsHandler extends SettingsHandler {
|
|||
return val['value'];
|
||||
}
|
||||
|
||||
// Special case for old useIRCLayout setting
|
||||
if (settingName === "layout") {
|
||||
const settings = this.getSettings() || {};
|
||||
if (settings["useIRCLayout"]) return Layout.IRC;
|
||||
return settings[settingName];
|
||||
}
|
||||
|
||||
const settings = this.getSettings() || {};
|
||||
return settings[settingName];
|
||||
}
|
||||
|
@ -106,6 +114,18 @@ export default class DeviceSettingsHandler extends SettingsHandler {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// Special case for old useIRCLayout setting
|
||||
if (settingName === "layout") {
|
||||
const settings = this.getSettings() || {};
|
||||
|
||||
delete settings["useIRCLayout"];
|
||||
settings["layout"] = newValue;
|
||||
localStorage.setItem("mx_local_settings", JSON.stringify(settings));
|
||||
|
||||
this.watchers.notifyUpdate(settingName, null, SettingLevel.DEVICE, newValue);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const settings = this.getSettings() || {};
|
||||
settings[settingName] = newValue;
|
||||
localStorage.setItem("mx_local_settings", JSON.stringify(settings));
|
||||
|
|
Loading…
Reference in New Issue