Confirm get action before executing

This commit is contained in:
Mo Bitar
2019-04-01 11:00:36 -05:00
parent 4b76c2a247
commit 9f81daee63
2 changed files with 16 additions and 12 deletions

View File

@@ -39,10 +39,13 @@ class ActionsMenu {
// reload extension actions // reload extension actions
actionsManager.loadExtensionInContextOfItem(extension, $scope.item, function(ext){ actionsManager.loadExtensionInContextOfItem(extension, $scope.item, function(ext){
// keep nested state // keep nested state
if(parentAction) { // 4/1/2019: We're not going to do this anymore because we're no longer using nested actions for version history,
var matchingAction = _.find(ext.actions, {label: parentAction.label}); // and also because finding the parentAction based on only label is not good enough. Two actions can have same label.
matchingAction.subrows = $scope.subRowsForAction(parentAction, extension); // We'd need a way to track actions after they are reloaded, but there's no good way to do this.
} // if(parentAction) {
// var matchingAction = _.find(ext.actions, {label: parentAction.label});
// matchingAction.subrows = $scope.subRowsForAction(parentAction, extension);
// }
}); });
}) })
} }

View File

@@ -122,18 +122,19 @@ class ActionsManager {
switch (action.verb) { switch (action.verb) {
case "get": { case "get": {
this.httpManager.getAbsolute(action.url, {}, async (response) => { if(confirm("Are you sure you want to replace the current note contents with this action's results?")) {
action.error = false; this.httpManager.getAbsolute(action.url, {}, async (response) => {
handleResponseDecryption(response, await this.authManager.keys(), true); action.error = false;
}, (response) => { handleResponseDecryption(response, await this.authManager.keys(), true);
action.error = true; }, (response) => {
customCallback(null); action.error = true;
}) customCallback(null);
})
}
break; break;
} }
case "render": { case "render": {
this.httpManager.getAbsolute(action.url, {}, async (response) => { this.httpManager.getAbsolute(action.url, {}, async (response) => {
action.error = false; action.error = false;
handleResponseDecryption(response, await this.authManager.keys(), false); handleResponseDecryption(response, await this.authManager.keys(), false);