Skip to content

Commit

Permalink
move alwaysEnabled check to init (#3487)
Browse files Browse the repository at this point in the history
So that if a module was somehow disabled (or `alwaysEnabled` was set retroactively) it still won't act disabled.
  • Loading branch information
erikdesjardins committed Sep 27, 2016
1 parent 8ae5172 commit 90e6dd7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/core/modules/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export async function _loadModulePrefs() {
const storedPrefs = await Storage.get('RES.modulePrefs') || {};

for (const id in modules) {
if (id in storedPrefs) {
if (modules[id].alwaysEnabled) {
enabled[id] = true;
} else if (id in storedPrefs) {
enabled[id] = storedPrefs[id];
} else {
enabled[id] = !modules[id].disabledByDefault;
Expand All @@ -37,9 +39,6 @@ export async function _loadModulePrefs() {

export function setEnabled(opaqueId, enable) {
const module = get(opaqueId);
if (module.alwaysEnabled) {
return;
}
enable = !!enable;
// set enabled state of module
enabled[module.moduleID] = enable;
Expand Down

0 comments on commit 90e6dd7

Please sign in to comment.