diff --git a/src/settings/handlers/DeviceSettingsHandler.ts b/src/settings/handlers/DeviceSettingsHandler.ts index 2096203598..208a265e04 100644 --- a/src/settings/handlers/DeviceSettingsHandler.ts +++ b/src/settings/handlers/DeviceSettingsHandler.ts @@ -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));