From 51a68683f8fd4c13275a2260b298ce4f6aba10b7 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 4 Feb 2018 14:25:08 -0500 Subject: [PATCH] code review: fix error at extension console; allow recipes to override explicit rules --- src/js/messaging.js | 4 ++++ src/js/recipe-manager.js | 4 ++-- src/js/storage.js | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/messaging.js b/src/js/messaging.js index 6397ce3..7f0e80c 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -97,6 +97,10 @@ function onMessage(request, sender, callback) { µm.reloadHostsFiles(); break; + case 'reloadRecipeFiles': + µm.loadRecipes(true); + break; + case 'setMatrixSwitch': µm.tMatrix.setSwitch(request.switchName, '*', request.state); if ( µm.pMatrix.setSwitch(request.switchName, '*', request.state) ) { diff --git a/src/js/recipe-manager.js b/src/js/recipe-manager.js index f34cb31..e7813da 100644 --- a/src/js/recipe-manager.js +++ b/src/js/recipe-manager.js @@ -175,12 +175,12 @@ if ( parts.length < 3 ) { continue; } let f2 = parts[2]; let action = tMatrix.evaluateCellZXY(f0, f1, f2); - if ( action === 1 ) { + if ( (action & 3) === 1 ) { tMatrix.whitelistCell(f0, f1, f2); } if ( details.commit !== true ) { continue; } action = pMatrix.evaluateCellZXY(f0, f1, f2); - if ( action === 1 ) { + if ( (action & 3) === 1 ) { pMatrix.whitelistCell(f0, f1, f2); mustPersist = true; } diff --git a/src/js/storage.js b/src/js/storage.js index 3787589..43e7609 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -705,7 +705,6 @@ ); if ( recipesChanged ) { µm.recipeManager.reset(); - µm.loadRecipes(true); } if ( typeof callback === 'function' ) { callback({