Appease the linter round 1

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-10-28 19:53:12 -06:00
parent 23d159e21c
commit 7dda5e9196
9 changed files with 16 additions and 25 deletions

View File

@ -46,4 +46,4 @@ export default class AccountSettingHandler extends SettingsHandler {
if (!event || !event.getContent()) return {};
return event.getContent();
}
}
}

View File

@ -40,4 +40,4 @@ export default class ConfigSettingsHandler extends SettingsHandler {
isSupported() {
return true; // SdkConfig is always there
}
}
}

View File

@ -46,4 +46,4 @@ export default class DefaultSettingsHandler extends SettingsHandler {
isSupported() {
return true;
}
}
}

View File

@ -87,4 +87,4 @@ export default class DeviceSettingsHandler extends SettingsHandler {
_writeFeature(featureName, enabled) {
localStorage.setItem("mx_labs_feature_" + featureName, enabled);
}
}
}

View File

@ -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();
}
}
}

View File

@ -50,4 +50,4 @@ export default class RoomDeviceSettingsHandler extends SettingsHandler {
_getKey(settingName, roomId) {
return "mx_setting_" + settingName + "_" + roomId;
}
}
}

View File

@ -51,4 +51,4 @@ export default class RoomSettingsHandler extends SettingsHandler {
if (!event || !event.getContent()) return {};
return event.getContent();
}
}
}

View File

@ -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<object>} 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;
}
}
}

View File

@ -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;