mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 22:14:58 +08:00
Appease the linter round 1
Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
parent
23d159e21c
commit
7dda5e9196
@ -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';
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user