From 7dda5e9196710d82bd64284a9f895a1d29c46d69 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 28 Oct 2017 19:53:12 -0600 Subject: [PATCH] Appease the linter round 1 Signed-off-by: Travis Ralston --- src/settings/AccountSettingsHandler.js | 2 +- src/settings/ConfigSettingsHandler.js | 2 +- src/settings/DefaultSettingsHandler.js | 2 +- src/settings/DeviceSettingsHandler.js | 2 +- src/settings/RoomAccountSettingsHandler.js | 3 +-- src/settings/RoomDeviceSettingsHandler.js | 2 +- src/settings/RoomSettingsHandler.js | 2 +- src/settings/SettingsHandler.js | 9 +++------ src/settings/SettingsStore.js | 17 ++++++----------- 9 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/settings/AccountSettingsHandler.js b/src/settings/AccountSettingsHandler.js index c505afe31d..db25cd0737 100644 --- a/src/settings/AccountSettingsHandler.js +++ b/src/settings/AccountSettingsHandler.js @@ -46,4 +46,4 @@ export default class AccountSettingHandler extends SettingsHandler { if (!event || !event.getContent()) return {}; return event.getContent(); } -} \ No newline at end of file +} diff --git a/src/settings/ConfigSettingsHandler.js b/src/settings/ConfigSettingsHandler.js index 5307a1dac1..5cd6d22411 100644 --- a/src/settings/ConfigSettingsHandler.js +++ b/src/settings/ConfigSettingsHandler.js @@ -40,4 +40,4 @@ export default class ConfigSettingsHandler extends SettingsHandler { isSupported() { return true; // SdkConfig is always there } -} \ No newline at end of file +} diff --git a/src/settings/DefaultSettingsHandler.js b/src/settings/DefaultSettingsHandler.js index 0a4b8d91d3..2c3a05a18a 100644 --- a/src/settings/DefaultSettingsHandler.js +++ b/src/settings/DefaultSettingsHandler.js @@ -46,4 +46,4 @@ export default class DefaultSettingsHandler extends SettingsHandler { isSupported() { return true; } -} \ No newline at end of file +} diff --git a/src/settings/DeviceSettingsHandler.js b/src/settings/DeviceSettingsHandler.js index dbb833c570..329634a810 100644 --- a/src/settings/DeviceSettingsHandler.js +++ b/src/settings/DeviceSettingsHandler.js @@ -87,4 +87,4 @@ export default class DeviceSettingsHandler extends SettingsHandler { _writeFeature(featureName, enabled) { localStorage.setItem("mx_labs_feature_" + featureName, enabled); } -} \ No newline at end of file +} diff --git a/src/settings/RoomAccountSettingsHandler.js b/src/settings/RoomAccountSettingsHandler.js index 3c775f3ff0..e1edaffb90 100644 --- a/src/settings/RoomAccountSettingsHandler.js +++ b/src/settings/RoomAccountSettingsHandler.js @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Promise from 'bluebird'; import SettingsHandler from "./SettingsHandler"; import MatrixClientPeg from '../MatrixClientPeg'; @@ -49,4 +48,4 @@ export default class RoomAccountSettingsHandler extends SettingsHandler { if (!event || !event.getContent()) return {}; return event.getContent(); } -} \ No newline at end of file +} diff --git a/src/settings/RoomDeviceSettingsHandler.js b/src/settings/RoomDeviceSettingsHandler.js index 3ee83f2362..b61e266a4a 100644 --- a/src/settings/RoomDeviceSettingsHandler.js +++ b/src/settings/RoomDeviceSettingsHandler.js @@ -50,4 +50,4 @@ export default class RoomDeviceSettingsHandler extends SettingsHandler { _getKey(settingName, roomId) { return "mx_setting_" + settingName + "_" + roomId; } -} \ No newline at end of file +} diff --git a/src/settings/RoomSettingsHandler.js b/src/settings/RoomSettingsHandler.js index c41a510646..91bcff384a 100644 --- a/src/settings/RoomSettingsHandler.js +++ b/src/settings/RoomSettingsHandler.js @@ -51,4 +51,4 @@ export default class RoomSettingsHandler extends SettingsHandler { if (!event || !event.getContent()) return {}; return event.getContent(); } -} \ No newline at end of file +} diff --git a/src/settings/SettingsHandler.js b/src/settings/SettingsHandler.js index 20f09cb1f2..49265feb9a 100644 --- a/src/settings/SettingsHandler.js +++ b/src/settings/SettingsHandler.js @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -import Promise from 'bluebird'; - /** * Represents the base class for all level handlers. This class performs no logic * and should be overridden. @@ -27,8 +25,7 @@ export default class SettingsHandler { * applicable to this level and may be ignored by the handler. * @param {string} settingName The name of the setting. * @param {String} roomId The room ID to read from, may be null. - * @return {Promise} Resolves to the setting value. Rejected if the value - * could not be found. + * @returns {*} The setting value, or null if not found. */ getValue(settingName, roomId) { throw new Error("Operation not possible: getValue was not overridden"); @@ -43,7 +40,7 @@ export default class SettingsHandler { * @param {string} settingName The name of the setting to change. * @param {String} roomId The room ID to set the value in, may be null. * @param {*} newValue The new value for the setting, may be null. - * @return {Promise} Resolves when the setting has been saved. + * @returns {Promise} Resolves when the setting has been saved. */ setValue(settingName, roomId, newValue) { throw new Error("Operation not possible: setValue was not overridden"); @@ -67,4 +64,4 @@ export default class SettingsHandler { isSupported() { return false; } -} \ No newline at end of file +} diff --git a/src/settings/SettingsStore.js b/src/settings/SettingsStore.js index 330c2def05..e73be42887 100644 --- a/src/settings/SettingsStore.js +++ b/src/settings/SettingsStore.js @@ -59,9 +59,9 @@ const SETTINGS = { }; // Convert the above into simpler formats for the handlers -let defaultSettings = {}; -let featureNames = []; -for (let key of Object.keys(SETTINGS)) { +const defaultSettings = {}; +const featureNames = []; +for (const key of Object.keys(SETTINGS)) { defaultSettings[key] = SETTINGS[key].defaults; if (SETTINGS[key].isFeature) featureNames.push(key); } @@ -132,12 +132,7 @@ export default class SettingsStore { throw new Error("Setting " + settingName + " is not a feature"); } - // Synchronously get the setting value (which should be {enabled: true/false}) - const value = Promise.coroutine(function* () { - return yield SettingsStore.getValue(settingName, roomId); - })(); - - return value; + return SettingsStore.getValue(settingName, roomId); } /** @@ -149,7 +144,7 @@ export default class SettingsStore { */ static getValue(settingName, roomId) { const levelOrder = [ - 'device', 'room-device', 'room-account', 'account', 'room', 'config', 'default' + 'device', 'room-device', 'room-account', 'account', 'room', 'config', 'default', ]; if (SettingsStore.isFeature(settingName)) { @@ -161,7 +156,7 @@ export default class SettingsStore { const handlers = SettingsStore._getHandlers(settingName); - for (let level of levelOrder) { + for (const level of levelOrder) { let handler = handlers[level]; if (!handler) continue;